How to unzip a group of zip files?

The following one-line batch script will unzip all zip files in current directory to separate directories. Assuming you have an unzip tool in your path…

It checks each zip file in current directory and if there is no directory with same name as the file name without extension – it creates the directory and unzips the file into the directory.

for %a in (*.zip) DO (if not exist %~na (md %~na & cd %~na & unzip ..\%a & cd ..))

This one will also delete the zip files:

for %a in (*.zip) DO (if not exist %~na (md %~na & cd %~na & unzip ..\%a & cd .. & del /q %a))

Advertisements
Tagged

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: