cbz2ebook: work with nested directories

This commit is contained in:
Simon Bruder 2020-02-25 23:30:26 +00:00
parent 687e9e0812
commit 0984845eab
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F

View file

@ -18,10 +18,10 @@ trap cleanup EXIT INT SIGTERM
cd "$tmpdir"
unzip "$infile"
renumber 4 **/*
length=$(ls -1 **/* | wc -l)
renumber 4 **/*.???
length=$(ls -1 **/*.??? | wc -l)
position=0
for image in **/*; do
for image in **/*.???; do
width=$(identify -format "%W" "$image")
height=$(identify -format "%H" "$image")
if (($width > $height)); then
@ -33,5 +33,5 @@ for image in **/*; do
echo -ne "$(printf '%3s' $((100 * $position / $length))) % "$(printf "%0*d" "$((72 * $position / $length))" 0 | tr '0' '#')'\r'
done
echo
zip "$outfile" **/*
zip "$outfile" **/*.???
cd -