How can you extract only the target dir and not the complete dir tree?
compress
tar cf /var/www_bak/site.tar /var/www/site
extract
tar xf /var/www/site.tar -C /tmp
This will produce:
/tmp/var/www/site
How is it possible to avoid the whole dir tree to be created when the file is extracted?
What I want it to extract to:
/tmp/site
You want to use the
--strip-components=NUMBER
option oftar
:Your command would be:
Why not use
-C
option when creating: