Skip to content

Instantly share code, notes, and snippets.

@namklabs
Created April 18, 2013 16:53
Show Gist options
  • Save namklabs/5414323 to your computer and use it in GitHub Desktop.
Save namklabs/5414323 to your computer and use it in GitHub Desktop.
untar a tar.gz file from one directory into another directory AND remove the containing folder of the untarred archive
# inspired from http://drupal.org/node/207095
tar -C /extract/archive/here/ -zxvf ~/Downloads/myarchive.tar.gz --strip 1
# tar is the command
# -C lets you choose what directory to put the untarred archive into.
# The target directory is specified just like any other command in shell.
# -zxvf does a bunch of stuff. Just use it, or take out the v because that makes the command display the filename of each file that is extracted.
# The second path is where your archive is located.
# --strip 1 removes the directory that will be containing your files. There is always a 'myarchive' folder around the files in a myarchive.tar.gz. This will prevent that. So, be sure to set the first path of the command to a dir that you want all your files to be dumped into!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment