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

data.zip 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

1 Answer 1

up vote 3 down vote accepted
find some/dir -name data.txt | zip -@ data.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 all_data.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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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