Skip to content

Instantly share code, notes, and snippets.

@ArneGockeln
Created June 19, 2018 09:57
Show Gist options
  • Save ArneGockeln/8f1eb9043559786602f564b309e0feb1 to your computer and use it in GitHub Desktop.
Save ArneGockeln/8f1eb9043559786602f564b309e0feb1 to your computer and use it in GitHub Desktop.
Create tar.gz archives inside _backup directory for all directories in path
# create folder _backup inside search path if it does not exist
mkdir -p _backup
# this finds all directories inside . excluding _backup and executes tar cvzf command.
# it creates a tar archive inside _backup folder with the name <foldername>.tar.gz
find . -mindepth 1 -maxdepth 1 -type d -not -path "./_backup" -exec tar cvzf _backup/{}.tar.gz {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment