Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a file that contain list of files I want to archive with tar. Let's call it mylist.txt

It contains:


What I want to do is to archive this file into a tarball but excluding /path1/path2/. Currently by doing this:

tar -cvf allfiles.tar -T mylist.txt

preserves the path after unarchiving.

I tried this but won't work too:

tar -cvf -C /path1/path2 allfiles.tar -T mylist.txt

It archives all the files in /path1/path2 even those which are not in mylist.txt

Is there a way to do it?


1 Answer 1

Maybe you could try with the --exclude parameter of tar :

tar -cvf allfiles.tar -T mylist.txt --exclude=/path1/path2
Thanks. Tried that. It still won't do. The path still preserved. –  neversaint Nov 7 '11 at 22:28

This site is currently not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .