Search This Blog

tar: exclude leading part of the absolute path when making an archive

  • When archiving /dir1/dir2/dir3/*.txt using tar, I want to include only the dir3/*.txt in the archive. -C option (means change directory to) can be used.

    tar -C /dir1/dir2 -cvf dir3.tar dir3/*.txt

No comments:

Post a Comment