Search code examples
windowsbatch-filezip7zip

How to add a file in multiple zip files?


Im trying to move a picture in every zip folder in current directory. I searched online for some guidance on how to do it using batch (.bat) and the only solution I figured out is to make a macro of it but it takes too long for it to complete.

Edit: I have 50 zip folders which I want to add a picture inside each one in a faster way other than draging the picture each time inside each of the 50 zip folders.

I would appreciate any other ideas and help you could offer.


Solution

  • Test this on some sample zip files in a test folder. It assumes 7-zip is in the folder shown.

    It's not so much faster as it is easier, without manually manipulating the files.
    The actual zipping speed will be pretty much the same.

    @echo off
    for /f "delims=" %%a in ('dir *.zip /b /a-d') do (
       "C:\Program Files\7-Zip\7z.exe" a "%%a" "my-picture.jpg"
    )
    pause