Last active
May 10, 2017 02:52
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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