Thursday, November 15, 2007

Fake project directories in tarballs

To make a tarball where all the files are in a subdirectory FOO (as per best practices), where FOO doesn't really exist on your disk (e.g., FOO may be PROJECT-vX.Y.Z and the files are in directory PROJECT), just do


tar cvf NAME.tar --transform=s,^,FOO/,g FILES

Note that the argument to transform in this case is just a sed command with commas instead of slashes.

No comments: