I want to make a tar archive containing various files scattered around the filesystem:
$ tar czvf outfile.tar.gz /some/file /some/other/filename
This creates the archive successfully, but when I extract it, the files are still in a directory tree matching the original locations:
$ tar xvf outfile.tar.gz some/file some/other/filename
I'd like to have them both extracted to the current directory, such that
filename are created on their own.
I can do this at extract time using
$ tar xvf outfile.tar.gz --transform=s,.*/,,
This does what I want, but it's a bit annoying to have to use an obscure option at extract-time, makes it more difficult to send to others, and so forth.
I could do it at create-time like this:
$ cd tmpdir $ cp /some/file /some/other/filename . $ tar czvf outfile.tar.gz *
But that seems a bit heavyweight, especially if there are large files or a lot of them.
Is there any way to control the filenames that
tar stores at create-time directly?