tar without full directory hierarchy
Hi
Im trying to back up of a directory using tar with --gzip option. Its on Fedora Core 2 with Plesk 7.5 loaded. I download the .tgz file to my PC and opened it with 7z and found that it has also compressed the folder hierarchy. So if I extrac it to C:, it'll create a folder called /var/www/vhosts/mydomain.com/httpdcos which is not what I want. 1. I want it such that if I extract it to C:, all files & directories in httdocs gets extracted to C: directly. What option do I need to specify here ? 2. Later I want to extract it to another linux server to a destination folder, how do I so that ? Code:
tar --create --gzip --file="mydomain.com.tgz" "/var/www/vhosts/mydomain.com/httpdocs/" Code:
tar --create --gzip --directory="/var/www/vhosts/mydomain.com/" --file="mydomain.com.tgz" "httpdocs/" But this doest seem to work : Code:
tar --create --gzip --directory="/var/www/vhosts/mydomain.com/httpdocs/" --file="mydomain.com.tgz" "/" Code:
tar: Removing leading `/' from member names (I do want sub-directories of httpdocs though) Thanks |
CD into the httpdocs directory before running tar.
Then the contents will be of the contents of httpdocs, including it's subdirectories. Or CD into "/var/www/vhosts/mydomain.com/" and use httpdocs as the file... argument. This way when you extract, it will create an httpdocs directory, so you won't have to do that manually. |
Dont want CD to httpdocs because Im writing a script to do this for many domain directories.
Quote:
Anyway, I found the answer to this. As simple as "./" instead of "/" Code:
tar --create --gzip --directory="/var/www/vhosts/mydomain.com/httpdocs/" --file="mydomain.com.tgz" "./" |
All times are GMT -5. The time now is 07:06 AM. |