Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

zip -r /tmp/foo/bar.zip /tmp/foo/* > /dev/null 2>&1

and the achieve is in this structure

   /tmp
      /foo
         file1
         file2
         dir1/
           file3
         dir/2
           file4

Why is /tmp part of the structure?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

It is because you tell it to do that ;-)

I would do something like this:

cd /tmp && zip -r /tmp/bar.zip ./foo/* >/dev/null 2>&1
share|improve this answer
    
Thanks. So it has to be relative. –  CppLearner Feb 15 '13 at 19:17
    
Why ** instead of *? –  Eliah Kagan Feb 15 '13 at 19:19
    
where do you see **? >:D (no idea where that came from :X ) –  Rinzwind Feb 15 '13 at 19:20
add comment

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.