JSI Tip 0866. Find all mis-matched compressed objects.
November 24, 1998
A mis-matched compressed object is one that does not match the compression status of it's parent folder.
If a folder is compressed, but some of its' files or sub-folders are not, they are considered mis-matched.
If a folder is not compressed, any compressed files or sub-folders in it are considered to be mis-matched.
If a drive is compressed, any non-compressed object on it is mis-matched.
If a drive is not compressed, any compressed folder on it is mis-matched.
JSIcmpr.bat is a script that will locate mis-matched compressed objects. The syntax is:
JSIcmpr Drive1 [Drive2 Drive3 ..... DriveN] where:
- is the full path to the file that will contain the report.
Drive1 - is a drive letter to check ( C C: C: are all acceptable formats).
Note: I did not make any effort to suppress error messages caused by object names that contain & (or the like).
Note: I did not test this script with a compressed drive. If you have one, and run the script on it, let me know if the report is inaccurate.
JSIcmpr.bat contains:
@echo off
if "%1"
"" goto syntax
if "%2"
"" goto syntax
set report=%1
@echo Begin Compressed Report > %report%
:loop
shift
if "%1"
"" goto srt
set drive=%1
set drive=%drive::=%
set drive=%drive:=%
set drive=%drive%:
%drive%
cd %drive%
set tcpr=
call :comp
set tcpr=%cpr%
for /f "Tokens=*" %%i in ('dir %drive% /b /ad /s') do call :level1 "%%i"
goto loop
:srt
copy %report% %temp%jsicmpr.tmp
sort %report%
del /q %temp%jsicmpr.tmp
goto end
:level1
cd %1
call :comp
goto end
:comp
set of=
for /f "Tokens=1-7*" %%i in ('compact') do call :top %%i %%j %%k %%l %%m %%n "%%o" "%%p"
goto end
:top
if "%1"
"Listing" goto list
if not "%1"
"New" goto detail
set cpr=N
if %8
"be compressed." set cpr=Y
if "%tcpr%"
"%cpr%" goto end
if "%tcpr%"
"" goto end
@echo %fold% >> %report%
goto end
:detail
if "%1"
"Of" set of=Y
if "%of%"
"Y" goto end
set work1=%7%8
set work1=%work1:"=%
set work2="%work1%"
set work2=%work2:"C =%
set work2=%work2:"=%
if "%work1%"
"%work2%" goto compn
if "%cpr%"
"Y" goto end
@echo %fold%%work2% >> %report%
goto end
:compn
if "%cpr%"=="N" goto end
@echo %fold%%work2% >> %report%
goto end
:list
set fold="%2!%3!%4!%5!%6!%7%8"
set fold=%fold:"=%
set fold=%fold:!!!=%
set fold=%fold:!!=%
set fold=%fold:!=%
set fold=%fold:!!!=%
set fold=%fold:!!=%
set fold=%fold:!= %
:end
About the Author
You May Also Like