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.

Alright so i have a zip file called data.zip on my desktop. Inside test.zip 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 data.zip 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 stackoverflow.com Feb 6 '11 at 1:34

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

add comment

1 Answer 1

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 data.zip 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.