Created
July 27, 2022 16:23
-
-
Save milleniumbug/69e208713b24a0843e635d33d6d4c9b0 to your computer and use it in GitHub Desktop.
given a download directory in Tachiyomi, prepare it for creating a cbz archive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find -name '.nomedia' -delete | |
for i in *; do | |
newname=$(echo "$i" | sed -r 's/.*Ch\.([0-9]+)\.?([0-9]*).*$/\1 \2/' | awk '{ printf("%05d%02d", $1, $2) }') | |
mv "$i" "$newname"; | |
done | |
find -name '*.png' -print0 -or -name '.jpg' -print0 | while IFS= read -r -d '' file; do d=`dirname $file`; b=`basename $file`; mv "$file" "${d}/${d}_${b}"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment