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?

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

3 Answers 3

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

You must log in to answer this question.

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