I want to use the zip command to create a .ZIP of a folder but only include .txt files.

Subdirectory structure should be preserved!

link|improve this question

78% accept rate
feedback

1 Answer

up vote 1 down vote accepted

If you're certain that none of the filenames will contain a newline then you can use find as explained in the zip(1) man page.

find some/dir -type f -name '*.txt' -print | zip ... -@ ...
link|improve this answer
1  
I'm afraid it specifically says MacOS X does not support this :( – macek Nov 7 '11 at 5:20
It says "MacOS". OS X is Unix, not MacOS. – Ignacio Vazquez-Abrams Nov 7 '11 at 5:27
feedback

Your Answer

 
or
required, but never shown

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