up vote 0 down vote favorite
share [g+] share [fb]

I have a folder structure like so:

file1
file2
file3
file4
folder1
folder2

Without writing each file, how can I tar zip all the files and folders, except file1 and folder1?

link|improve this question

62% accept rate
feedback

2 Answers

up vote 2 down vote accepted

tar has an --exclude switch.

link|improve this answer
feedback

You can use --exclude=pattern option which prevents any file or member whose name matches the wildcard (pattern) from being operated on. For example, to create an archive with all the contents of the directory src' except for files whose names end in .exe', use the command `tar -cf src.tar --exclude='*.exe' src'.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.