3

I have a file in folder/football.jpg that I want to zip. So I zip with the command

zip folder/football_zip folder/football.jpg

It works, except that the Zip file contains the folder folder, which contains football.jpg. How can I make the Zip file contain only football.jpg?

migrated from stackoverflow.com Nov 5 '12 at 9:47

This question came from our site for professional and enthusiast programmers.

  • Your question is off topic for Stack Overflow. Let's migrate it to superuser instead. – Brian Cain Nov 5 '12 at 2:43
  • Why is it off topic for Stack Overflow, and what is superuser? – Mika H. Nov 5 '12 at 2:58
  • stackoverflow.com/faq#dontask -- skip down to "if your question would be of interest to..." – Brian Cain Nov 5 '12 at 3:05
3

The zip command has a -j switch that will do this:

zip -j folder/football_zip folder/football.jpg
1

This should work:

cd folder
zip ../football.zip ./football.jpg
0

how about:

cd folder
zip football_zip football.jpg

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.