I'm trying to modify a certain tar.gz archive I have. When I go to create the tar, it retains the parent directory structure, as a tarball should. However, is there a way to simply create a tar archive with just the files I specifiy, rather than the entire directory tree?
Tell me more
×
Server Fault is a question and answer site for
professional system and network administrators. It's 100% free, no registration required.
|
|
Disabling recursion in tar. POSIX pax(1) has -d option which enables cpio-like interface while allowing to create .tar files. Example from Wikipedia:
GNU tar(1) has an analogous option, --no-recursion. Example from there:
P.S. I usually fall back to cpio(1) in such cases. |
||||
|
|
|
It's a little dirty, but yes:
|
|||
|
|
|
Specifying the full path of a file will preserve the tree:
To omit the file structure, cd to the directory and create the archive:
|
||||
|
|