Reputation: 553
I have a shell script that unzips an input directory of xml files into another directory, and then zips that directory. I am checking at each step if an error code is returned. I am looking for a scenario where the zip of the new folder with the xml files will fail. Here are the error codes for reference http://www.info-zip.org/FAQ.html
It seems like if the script gets to the point where it is about to zip the new folder without errors, then none of these could apply. Is it possible to create some kind of folder/file structure or type of file that will not be zipped successfully?
Upvotes: 0
Views: 1811
Reputation: 123450
You can trivially do this with chmod
to deny access to the file:
$ touch file
$ chmod 000 file
$ zip file.zip file
adding: file
zip warning: Permission denied
zip warning: could not open for reading: file
zip warning: Not all files were readable
files/entries read: 0 (0 bytes) skipped: 1 (0 bytes)
(zip
exits with error code 18)
Upvotes: 1