raskren Posted March 12, 2005 Posted March 12, 2005 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.
Bâshrat the Sneaky Posted March 12, 2005 Posted March 12, 2005 This is the script that I use. It searches the folder %FOLDER% recursively@ECHO OFFCOLOR FCTITLE Compressing all drivers...if %1.==Sub. goto %2SET FOLDER=YOURFOLDERFOR /R %FOLDER% %%a IN (*.*) DO (call %0 Sub makeIt "%%a")REM commands after compressing come heregoto EXIT:makeItsetlocalfor %%a in (%3) do set naam=%%~nxafor %%a in (%3) do set pad=%%~dpaif /I %naam:~-1%==_ goto endif /I %naam:~-3%==cat goto endif /I %naam:~-3%==inf goto endif /I %naam:~-3%==cmd goto endif /I "%naam%"=="somefile.exe" goto endECHO.ECHO Compressing %naam%...set naam=%naam:~0,-1%_MAKECAB /D CompressionType=LZX /D CompressionMemory=21 %3 "%naam%" > NULDEL /F /Q %3move "%naam%" "%pad%%naam%"endlocalgoto end:EXITEXIT:endthe IF /I blabla things are exclusions; files that should NOT be compressedEDIT: some vars are in Dutch naam=name=filenamepad=pathBTW... 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')
djbe Posted March 12, 2005 Posted March 12, 2005 the IF /I blabla things are exclusions; files that should NOT be compressed<{POST_SNAPBACK}>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 )
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now