Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Subdirectory structure should be preserved!

share|improve this question
up vote 2 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 ... -@ ...
share|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

You must log in to answer this question.

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