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 have an account on AWS and I use S3 for storing data. I have commands that will enable me to zip data files like so: s3_dir/level-1/level-2/*/*/data.txt

But there are, say, 50 or more levels. I want to zip all the data.txt files together from all levels. I'm not as sharp on my Bash as I could be so any help would be much appreciated.

share|improve this question
does it have to be a zip file? Can you use gzip instead? It's not the same format, but I know it can be recursive with the -r option... – tjameson Apr 18 '11 at 22:36
up vote 3 down vote accepted
find some/dir -name data.txt | zip -@
share|improve this answer
This is perfect... Actually, right after I posted this question, a buddy gave me some hints... The command I used was: find /some/path -name '*.txt' | xargs -n 100 zip – nicorellius Apr 18 '11 at 22:39
What's the -@ for BTW? – nicorellius Apr 18 '11 at 22:39
It tells zip to get the list of filenames from stdin, so that you don't need to use xargs. – Ignacio Vazquez-Abrams Apr 18 '11 at 22:40

You must log in to answer this question.

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