Linux – How to you designate an arbitrary leading path when adding files to a tar

linuxtar

Is it possible to set an arbitrary path within a tar archive to place files which may not exist on your original filesystem? This differs from the -C switch in that I may want to take a back up of /etc/, but place it in the archive as /configurations/etc/.

Best Answer

In GNU tar, --transform (--xform) is the option to make file name transformations. Documentation and examples can be found here