Let’s say you have some 100 archive files in rar or zip format spread inside more than one directory. Definitely, it’s not going to be a walk in the park to unzip all these files by right-clicking on each file and then clicking on the Extract option. Obviously, you are here to automate this process somehow. Well, we’ve got your back.
In this article, we explain in detail how you can easily unzip all the archives inside a folder and its subfolders recursively in one go.
Note: Please make sure that you have 7-Zip software installed on your machine. If not, you can get it from here.
Step 1: On the Taskbar, click on the Search icon.
Step 2: In the Search bar, type in notepad and choose Notepad App from the Best match section.
Step 3: When Notepad opens up, copy and paste the following code.
FOR /D /r %%F in (".") DO ( pushd %CD% cd %%F FOR %%X in (*.rar *.zip) DO ( "C:\Program Files-zipz.exe" x "%%X" ) popd )
Note: This code would unzip all the archives present inside the folder where this batch script is present at. It will also extract all the archives present inside all the subfolders inside the main folder recursively.
Step 4: Once the code is copied, hit the File tab at the top. Then click on the Save As option.
Step 5: In the Save As window, navigate to the location where your folder containing the archives is present at.
Once you are at the location, give a name to your file. But make sure to give the extension of the file as .bat.
As next, set Save as type as All Files (*.*).
Once done, hit the Save button.
Step 6: Now go to the location where you have saved your batch file. Double click on it to execute it.
Step 7: If you see now, the zip file that was present in the above screenshot got extracted successfully.
Note: If you go inside the subfolders, you will be able to see that the archives inside these subfolders are also extracted.
That’s it. Please tell us in the comments section whether you found the article useful.
Someone who is in love with writing and technical tricks & tips.