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

Alright so i have a zip file called on my desktop. Inside is another folder called res and inside res is a file called info.txt I have used the zip -u command before to move a file inside the zip but only to the root of the zip i want to move a new version of info.txt from my desktop to the res folder of i need it for part of a script i'm working on. How can i do this or will the -u function only work for the root? Thank you for any help on how i can accomplish this

share|improve this question

migrated from Feb 6 '11 at 1:34

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

Use the -j option (*j*unk the pathname) if you want to target the root of the zip; in order to target a subdirectory, you'll need to arrange your current directory such that the relative path from it to the file matches the relative path inside the zipfile. Something like this:

mkdir res
cp $DESKTOP/info.txt res
zip -u res/info.txt
rm -rf res
share|improve this answer
Worked perfectly thanks a ton didn't think to put the info.txt in a res folder on my desktop – Anonymous Feb 2 '11 at 23:32

You must log in to answer this question.