# Windows – How to recursively extract zip files on Windows including deletion

windowszip

How can I recursively extract zip files on Windows? Each zip file should be unzipped in a new subdirectory, and the zip file should be deleted afterwards.

Each existing or created directory should be scanned for further existing zip files, and so forth.

So the problem is, that I have a huge zip file, which contains many directories with perhaps many further zip files. The original zip files should simply be freed from any zip files, the originial directory tree should be kept, with the convention that each zip file should be represented as a own directory.

So the logic behind is: unzip file in a directory and delete zip file -> go into that directory and unzip all zip files there in the same way -> go into every exisiting subdirectory of the directory and do the same -> and so on recursively

Rough proposal for a recursively programmed batch script file:

unzip_folder(%%directory):

for %%file (%%directory/*.zip) do (unzip %%file | del %%file)

for /d %%directory (*) do ( call unzip_folder(%%directory) )

return