Skip to content

Instantly share code, notes, and snippets.

@Hylke1982
Created April 24, 2018 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hylke1982/d0e534a0108529e7d4c631d34cd157d7 to your computer and use it in GitHub Desktop.
Save Hylke1982/d0e534a0108529e7d4c631d34cd157d7 to your computer and use it in GitHub Desktop.
Extract .tar.gz2 recursive in their directories
for i in **/*.tar.bz2; do # Whitespace-safe and recursive
last=${i##*/}
directory="${i%/*}"
file=${last%%.*}
echo "$directory|$file|$last"
targetDir="$directory/$file"
mkdir -p $targetDir
tar xvjf $i -C $targetDir
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment