Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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
up vote 3 down vote accepted

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

zip -j folder/football_zip folder/football.jpg
share|improve this answer

This should work:

cd folder
zip ../football.zip ./football.jpg
share|improve this answer

how about:

cd folder
zip football_zip football.jpg
share|improve this answer

You must log in to answer this question.

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