7

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?

8

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
  • Why ** instead of *? – Eliah Kagan Feb 15 '13 at 19:19
  • 1
    where do you see **? >:D (no idea where that came from :X ) – Rinzwind Feb 15 '13 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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