The context:
In a specific folder I have multiple zip files. I have a code which takes all the zip files in that folder and unpack them in separate folders
The code:
Code: Select all
@echo off
setlocal enableExtensions disableDelayedExpansion
for /r "%cd%" %%a in ("*.zip") do powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('%%~fa', '00. %%~na'); }
What I'am trying to add to the mix.
- Before unpacking the zip file, create a new folder, where I move the zip file and after that unpack the zip file in that new folder
So, for:
Code: Select all
D:\Folder1
>D:\Folder1\file1.zip
>D:\Folder1\file2.zip
In the final I would have something like this:
Code: Select all
D:\Folder1
>D:\Folder1\01 - 342
>D:\Folder1\01 - 342\file1.zip
>D:\Folder1\01 - 342\00 - File1 (where I unpacked the zip file)
>D:\Folder1\02 - 5235
>D:\Folder1\02 - 5235\file2.zip
>D:\Folder1\02 - 5235\00 - File2 (where I unpacked the zip file)
When I am trying to add a piece of code (which is working just fine as itself) in my previous code, all the hell breaks. Even trying to add 2 commands in a for loop it's a pain in the butt.