Reputation: 2068
Scenario: a folder containing other folders
Folder\
Sample Folder 01\
Sample Folder 02\
.....
I need to run the follow command to each SampleFolderxx:
7z a -tzip "Sample Folder xx".cbz "Sample Folder xx"\ -mx0
How could I do a batch file to read each folder name in Folder\
and execute the command above?
Upvotes: 1
Views: 1062
Reputation: 62603
You need a for loop. Put the below lines into a .bat file, cd
to "Folder", paste the batch file there and run it.
@echo off
for /F "usebackq delims=" %%F in (`dir /b /ad-h`) do (
7z a -tzip "%%F".cbz "%%F"\ -mx0
)
Upvotes: 3