Skip to content

Instantly share code, notes, and snippets.

@pmachapman
Last active May 10, 2017 02:52
Show Gist options
  • Save pmachapman/f8d0337bae1f02f31fcb2ff15859effb to your computer and use it in GitHub Desktop.
Save pmachapman/f8d0337bae1f02f31fcb2ff15859effb to your computer and use it in GitHub Desktop.
Converts all tar.gz files in a directory to zip files. Can be used as a one line bash command.
#!/bin/bash
for f in *.tar.gz;\
do rm -rf "${f%.tar.gz}" ;\
mkdir "${f%.tar.gz}" ;\
tar zxvf "$f" -C "${f%.tar.gz}" ;\
zip -r9 "${f%.tar.gz}.zip" "${f%.tar.gz}" ;\
rm -rf "${f%.tar.gz}" ;\
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment