Skip to content

Instantly share code, notes, and snippets.

@milleniumbug
Created July 27, 2022 16:23
Show Gist options
  • Save milleniumbug/69e208713b24a0843e635d33d6d4c9b0 to your computer and use it in GitHub Desktop.
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
#!/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