Fix Corrupted Zip Files in Linux [Quick Tip]
Posted By Keith Dsouza On July 17, 2008 @ 7:12 am In Open Source Software | 6 Comments
It’s been a long time since I have talked about Linux, so here is something to get started again. This post talks about a common problem, Corrupted Zip Filewhich people face while downloading zip files from the Internet.
Not all the zip files can be recovered but using a few simple commands, you can try and recover the content without having to re-download the file again.
You can easily repair repairablezip files downloaded on Linux by issuing the following command;
zip F filename.zip
Issuing this command will tell the zip command to try to fix the zipfile if necessary. You can also issue the following command to make it the zip command work more harder on fixing the zip file.
zip FF filename.zip
I initially used this command as a patch to a shell script that read contents from a zip file, that was uploaded by a wizard, the patch was put in for zip files which were corrupted when uploaded over slower Internet connections.
Here is a part of the shell script for the geeks and power users reading Techie Buzz.
1: unzip -tqqq $x >> /dev/null;2: if [ $? -ne 0 ]; then
3: #Run Recovery mode first - do not remove this code - kd
4: zip -FF $x; 5: unzip -tqqq $x >> /dev/null;6: if [ $? -ne 0 ]; then
7: echo "Could not unzip $x. Renaming it to BADZIP-$x";
8: mv $x BADZIP-$x;9: continue;
10: fi 11: fiEnjoy and look forward to more Linux Tips.
Article printed from Techie Buzz: http://techie-buzz.com
URL to article: http://techie-buzz.com/foss/fix-corrupted-zip-files-in-linux-quick-tip.html
URLs in this post:
[1] Linux Tips: http://technorati.com/tags/Linux+Tips
[2] Recover Zip Files: http://technorati.com/tags/Recover+Zip+Files
[3] Linux Zip Files: http://technorati.com/tags/Linux+Zip+Files
[4] Corrupted Zip Files: http://technorati.com/tags/Corrupted+Zip+Files
[5] Zip Files: http://technorati.com/tags/Zip+Files
Click here to print.
Copyright © 2006-20011 Techie Buzz. All rights reserved.