1

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?

1 Answer 1

2

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 :)

You must log in to answer this question.