I know 'tar xf -C DIR' will untar the files in DIR, but is there an option to bundle the "-C DIR" information within the tarball when I create the tar file, so that when I use 'tar xf' the files will be automatically extracted into DIR?
Thanks.
I know 'tar xf -C DIR' will untar the files in DIR, but is there an option to bundle the "-C DIR" information within the tarball when I create the tar file, so that when I use 'tar xf' the files will be automatically extracted into DIR?
Thanks.
Create DIR, then symlink the files into DIR (no copying involved), then use GNU tar with the dereference (-h) option:
mkdir DIR
ln -s /path/to/f1 /path2/f2 DIR/
tar chf archive.tar DIR
rm -rf DIR
This will archive the actual files pointed by the symlinks (and not the symlinks you created temporarily)
Downside is you can't put actual symlinks in the archive, of course (they too will be dereferenced)