Created
April 18, 2013 16:53
-
-
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
This file contains 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
# 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