Skip to content

Instantly share code, notes, and snippets.

@Crhistoph
Last active December 16, 2015 10:19
Show Gist options
  • Save Crhistoph/5419489 to your computer and use it in GitHub Desktop.
Save Crhistoph/5419489 to your computer and use it in GitHub Desktop.
Reads a directory for .cbr and .cbz files, extracts accordingly.
#!/bin/bash
for file in *
do
: $((n = $n + 1))
if [[ $file == *.cbr ]]
then
mkdir "$n"
mv "$file" "$n"
cd $n
unrar e "$file" >/dev/null
echo "$file unrared"
rm "$file"
cd ../
elif [[ $file == *.cbz ]]
then
unzip -j "$file" -d "$n" >/dev/null
echo "$file unzipped"
rm "$file"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment