Un-tar a specific directory inside of a tar
I have the Wordpress tar, latest.tar.gz. Within it is the following structure /wordpress/dirtories/files
When I do the following command I would prefer if I could have it unpack starting at /directories/ and not /wordpress with the goal of installing wordpress in the root of my html directory.
tar -xzvf latest.tar.gz
Is this possible?
UPDATE
Sorry, the tar contains /wordpress/[Directories] and I want all the directories in [Directories] extracted to the current directory. Sorry for misleading you all.
Solution 1:
To strip down the parent directory:
tar zxvf latest.tar.gz --strip 1
If you want to be sure that nothing from the parent directory is extracted:
tar zxvf latest.tar.gz --strip 1 wordpress/directories
Edit:
--strip
(--strip-path
or --strip-components
) was introduced in tar 1.14.