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.

I've got a zip file that contains hundreds of files. Originally the files were in their own directories. Unfortunately, whoever zipped the file did not preserve the directory structure and some of the files have the same names. Is it possible to write a batch script (or whatever) that has WinZip (I'm stuck using WinZip and can't download/install any other programs) extract a file, allow me to perform an action on the extracted file (i.e. rename/move it), then procedd to the next file, etc?

share|improve this question
add comment

1 Answer

I really don't know if you can do it by batch (Even if you could I think it will add an unnecessary complexity on you problem). My solution would be to program in python(http://www.python.org/download/). I can give you some hints. To extract the contents:

import zipfile

a = zipfile.ZipFile("C:\\x.zip", 'r')
for i in a.namelist():         #Extract every file from it
     b = open("C:\\"+i, 'wb')
     b.write(a.read(i))
     #HERE YOU INSERT WHAT YOU WANT TO DO TO EACH FILE (b is the last file)
     b.close()
a.close()

I know this isn't stackoverfliow, but this is the only way I see this going well :)

share|improve this answer
add comment

Your Answer

 
discard

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