Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

3 Answers

up vote 2 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
add comment

how about:

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

This should work:

cd folder
zip ../football.zip ./football.jpg
share|improve this answer
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.