I have a set of .iso files in different directories and sub-directories:
app1.iso
app2.iso
app3.iso
a
@ECHO OFF
SETLOCAL
SET "sourcedir=U:\sourcedir"
FOR /f "delims=" %%a IN (
'dir /s/b /a-d "%sourcedir%\*.iso" '
) DO (
ECHO(7z a -t7z "%%~fa.7z" "%%~fa" -mx9 -mmt
)
GOTO :EOF
You would need to change the setting of sourcedir
to suit your circumstances.
The required 7z commands are merely ECHO
ed for testing purposes. After you've verified that the commands are correct, change ECHO(7z
to 7z
to actually archive the files.
Note that the redirection-to-log is missing. This is done to allow the proposed actions to be displayed to the screen.