Cage opened this issue on Feb 15, 2005 ยท 8 posts
tromnek posted Fri, 04 March 2005 at 10:23 AM
Hope my post is not too late. Yesterday I wanted to compress my entire 'libraries' folder and I wasn't happy with problem with WinZip.
It appears to me that WinZip chokes while making a temp file for extraction. It uses the entire filepath (with driveletter and colon) stored in the gzip header and appends it to your temp directory, thus an invalid filename. Here's a simple fix. Put the following code block above the
os.path.walk(dirToCompress, visit, arg)
line at the bottom of the script.
if ((winver==1) and (dirToCompress[1]==":")):<br></br> os.chdir( dirToCompress[:3] ) # change to drive and root of dirToCompress<br></br> dirToCompress = dirToCompress[3:] # strip the 'driveletter:' from the left<br></br>
There are a few other problems with the script.
When it searches for a file extension ('string.find()'), it should do a case insensitive search. It currently will miss a file named 'MyChar.CR2'. I should also probably do a 'string.rfind()' so that it checks the end string.
GzipFile is storing the 'compressed filename' in the header. I would rather have the 'source filename' stored so that I don't have a filename conflict while extracting to the same location.
Also, my preference is to have the gzip header filepath start at my runtime directory, not from the root of the drive.
I have a version with all the above modifications. I just wrote it last night so I haven't tested it extensively. Let me know if you want me to post it.