76
15
I have a zip archive (created automatically in a script with -j -r
flags) and I would like to remove a single file from it. I tried as documented.
zip -d "picture_43_9.jpg" gallery.zip
but I get this error:
zip warning: picture_43_9.jpg not found or empty
zip error: Nothing to do! (picture_43_9.jpg)
Anyway, there is such a file inside the archive and it is not empty:
unzip -l .../gallery.zip | grep -i 43_9.jpg
1477092 2013-05-22 14:23 picture_43_9.jpg
Any ideas on what I'm doing wrong?
@AlexFlo - You can pass filename arguments via STDIN and pipe to
zip
, as stated in the man page that you cited. For instance, if you're in a directory containingfile1.txt
,file2.txt
, andfile3.txt
, you can executels -1 | zip -q 'files.zip' -@
, which will create the archivefiles.zip
containing the 3 files you piped tozip
with their filenames intact. – rubynorails – 2015-10-23T02:15:21.870You're right, thanks, I got confused by the command line help of zip
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
– Alex Flo – 2013-05-27T08:23:28.100@AlexFlo: You may have a bad copy of the man page. The copy cited above says “[zipfile [file …]]”, which means you can have (a) no filename arguments at all (although I don’t know how that can be valid, other than when you’re asking for help), (b) a zipfile (archive file) name only, or (c) a zipfile name *followed by* one or more ordinary file names. (These can be the names of actual files to be inserted into the archive, or names of archive members to be manipulated.)
– Scott – 2013-12-02T21:15:04.907