Skip to content

Instantly share code, notes, and snippets.

@varunyellina
Created November 2, 2014 14:37
Show Gist options
  • Save varunyellina/b6c35a21f201438b4625 to your computer and use it in GitHub Desktop.
Save varunyellina/b6c35a21f201438b4625 to your computer and use it in GitHub Desktop.
Zip all folders in current directory and then change their extension.
#!/bin/sh
# Here i is the variable to which foldernames are assigned. %/ removes the trailing / from the filename when zipping
for i in */; do zip -r "${i%/}.zip" "$i"; done
# Rename the above zip files to have the extension .cbr for use with Comic book readers.
for i in *.zip; do mv "$i" "${i%.zip}.cbr"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment