Jump to content

Mszip Multiple Files


raskren

Recommended Posts

Hi, this one has been bugging me for a while. I've got a whole mess of driver files scattered in lots of directories. I'd like to compress all of the appropriate files with makecab to end up with "file.ex_" type files. The problem is that makecab doesn't accept wildcards so makecab.exe *.* doesn't work.

I'm aware of the driver compression script that someone made but these folder structures are so complex that it just makes a mess and I'd rather do it manually.

Link to comment
Share on other sites


This is the script that I use. It searches the folder %FOLDER% recursively


@ECHO OFF
COLOR FC
TITLE Compressing all drivers...
if %1.==Sub. goto %2

SET FOLDER=YOURFOLDER

FOR /R %FOLDER% %%a IN (*.*) DO (call %0 Sub makeIt "%%a")
REM commands after compressing come here

goto EXIT

:makeIt
setlocal

for %%a in (%3) do set naam=%%~nxa
for %%a in (%3) do set pad=%%~dpa

if /I %naam:~-1%==_ goto end
if /I %naam:~-3%==cat goto end
if /I %naam:~-3%==inf goto end
if /I %naam:~-3%==cmd goto end
if /I "%naam%"=="somefile.exe" goto end

ECHO.
ECHO Compressing %naam%...
set naam=%naam:~0,-1%_
MAKECAB /D CompressionType=LZX /D CompressionMemory=21 %3 "%naam%" > NUL
DEL /F /Q %3

move "%naam%" "%pad%%naam%"
endlocal
goto end

:EXIT
EXIT

:end

the IF /I blabla things are exclusions; files that should NOT be compressed

EDIT: some vars are in Dutch :P

naam=name=filename

pad=path

BTW... the cabbed file is placed in the same folder as the original one, the original one is being deleted (deleted by 'DEL /F /Q %3')

Link to comment
Share on other sites

the IF /I blabla things are exclusions; files that should NOT be compressed

And you don't wanna remove the

if /I %naam:~-1%==_ goto end

line, or else it will double compress all files... I also had a shorter version, but it needed to have makecab.exe in the same folder as the batch file...(dunno why, weird windows :P)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...