extract .zip files from multilple locations with Batch or Script file

Tellu Wsup 21 Reputation points
2021-09-02T16:46:54.3+00:00

I have a bunch of folders that contain .zip files. is it possible to run a batch that will search for zip files in multiple folders and automatically unzip them in the parent folder?

Windows for business | Windows Server | User experience | PowerShell
{count} votes

Accepted answer
  1. Andreas Baumgarten 123.6K Reputation points MVP Volunteer Moderator
    2021-09-02T18:14:14.74+00:00

    Hi @Tellu Wsup ,

    maybe this helps: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/expand-archive?view=powershell-7.1

    Very simple approach:

    Get-ChildItem *.zip | Expand-Archive  
    

    If you already have a script it would be helpful to post it here. It's easier to help that way.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


1 additional answer

Sort by: Most helpful
  1. Limitless Technology 39,926 Reputation points
    2021-09-03T11:41:28.897+00:00

    Hello,

    First you will need to have 7zip installed on the machine, then create a BAT file in the parent folder with content:

    FOR /D /r %%F in ("") DO (
    pushd %CD%
    cd %%F
    FOR %%X in (
    .rar *.zip) DO (
    "<7zipfolderandfilepath>" x "%%X"
    )
    popd
    )

    *replace <7zipfolderandfilepath> for the folder where 7zip is installed (for example: C:\Program Files\7-zip\7z.exe)

    Hope it helps!

    Best regards,


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.