Skip to content

Instantly share code, notes, and snippets.

@mo-han
Created March 16, 2019 18:05
Show Gist options
  • Save mo-han/5bae3bec9c6684bfefac145eb93482d4 to your computer and use it in GitHub Desktop.
Save mo-han/5bae3bec9c6684bfefac145eb93482d4 to your computer and use it in GitHub Desktop.
use zip to compress a folder into an cbz comic anchive
#!/bin/bash
for i in "$@"
do
if [ -d "$i" ]
then
parent=$(dirname "$i")
pushd $parent >/dev/null
echo $parent
dir=$(basename "$i")
echo "$dir -> $dir.cbz"
zip -g -r "$dir.cbz" "$dir" >/dev/null && rm -r "$i"
popd >/dev/null
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment