Skip to content

Instantly share code, notes, and snippets.

@linuxwizard
Last active May 26, 2017 02:35
Show Gist options
  • Save linuxwizard/4c6607119600bdbf3c8f1819c7fa3417 to your computer and use it in GitHub Desktop.
Save linuxwizard/4c6607119600bdbf3c8f1819c7fa3417 to your computer and use it in GitHub Desktop.
Bash script to create tar gzip archive
#Simple script to create a tar gzip archive of all directories inside the current directory excluding the shell file and removes the
#directory once archived
#!/bin/bash
#for i in `ls | awk '{print $0}'`
for i in `ls | grep -v zip.sh | awk -F. '{ print $1 }'`
do
tar -czvf $i.tar.gz $i/
echo $?
rm -rf $i/
echo $?
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment