Subj : CheckDrive BTM To : mark lewis From : Gerald Miller Date : Tue Aug 10 2004 08:12 pm Hello mark, Responding to a post in the 4DOS area: On Tuesday August 10 2004 at 09:29, mark lewis [1:3634/12] wrote to Gerald Miller, about: CheckDrive BTM GM>> Would someone please post the CHK_DRV.BTM written by GM>> Christopher Greaves Sunday, February 26, 1995? My GM>> copy got corrupted and my backup copy is also ruined. ml> sorry, i don't have it and can't seem to locate it on the 'net ml> anywhere... I likewise couldn't find a reference to the BTM _or_ the author on the net. I did find a "munged" version on an old floppy diskette and it looks like I was attempting to modify it for some reason or other... I'll post what I have and maybe some people can jump in to get it cleaned up / improved. === Begin cut: CHK_DRV.BTM === :: CHEcKDRIVe Christopher Greaves Sunday, February 26, 1995 :: Check the status of a nominated disk drive. :: Assumes DOS is on the path :: [trash] may point to a directory :: (default: not used) :: [netw] may point to a drive where the root belongs to us :: (default: not used) :: [date] may be set to a valid XCOPY date string :: (default: not used) :: [log] may be set to a logfile. :: (default: C:\%0.LOG) :: [debug] may be set to ON or OFF :: (default: OFF) :: Log on to the drive setlocal break on on break goto end on error (qedit /n%_batchline %@search[%0] %+ quit) :: Verify parameters if "%1"=="" goto 90help set drive=%1 set ram=g: %@upper[%drive%]: if exist %@upper[%drive%]:\scandisk.log del/q %= %@upper[%drive%]:\scandisk.log if exist %ram%\chekdriv.log del/q %ram%\chekdriv.log if exist %ram%\chkdrv.log del/q %ram%\chkdrv.log if "%debug%"=="" set debug=off echo %debug% if "%log%"=="" set log=%ram%\chekdriv.log echo %@upper[%0] Logged on to drive %@upper[%drive%]: %= | tee /a %log% echo %@upper[%0] Find File Allocation Table problems | tee /a %log% if exist %ram%\chk.$* del/q %ram%\chk.$* chkdsk /f > %ram%\chk.$1 find "non-contiguous" < %ram%\chk.$1 >%ram%\chk.$$2 find "lost clusters" < %ram%\chk.$1 >%ram%\chk.$$3 find "cross-linked" < %ram%\chk.$1 >%ram%\chk.$$4 copy %ram%\chk.$$* %ram%\chk.$5 >%ram%:\TEMP.MSG if not exist %ram%\chk.$5 goto 20NoProblem echo %@upper[%0] - chkdsk reports problems more < %ram%\chk.$1 echo. :20NoProblem echo %@upper[%0] Check available disk space | tee /a %log% echo. find <%ram%\chk.$1 "bytes available" | tee /a %log% find <%ram%\chk.$1 "bytes total disk" | tee /a %log% if exist %ram%\chk.$* del/q %ram%\chk.$* echo %@upper[%0] Locate permanent swap files | tee /a %log% dir \ /ah/s | find "PAR" >erase1 copy erase1+erase1 erase3 >%ram%:\TEMP.MSG if exist erase3 set permswap=%permswap%P dir \ /ah/s | find "SWP" >erase2 copy erase2+erase2 erase4 >%ram%:\TEMP.MSG if exist erase4 set permswap=%permswap%S echo %@upper[%0] Permanent swap file collection %permswap% %= | tee /a %log% if exist erase? del/q erase? echo %@upper[%0] Copy Trash (deleted) files to the network for %= backup | tee /a %log% if "%trash%"=="" goto 40Exit if not exist %trash%\nul goto 40Exit cd %trash% if not exist *.* goto 40Exit if "%netw%"=="" goto 40exit xcopy . %netw%\ for %%a in (*.*) do if exist %netw%\%%a del/q %%a :40Exit echo %@upper[%0] Copy changed files to the network drive for %= backup | tee /a %log% if "%netw%"=="" goto 60exit if not exist %netw%\nul goto 60exit xcopy %@upper[%drive%]:\ %netw%\ /s/e/m :60Exit echo %@upper[%0] Locate changed files | tee /a %log% attrib %@upper[%drive%]:*.* /s | find " A " | tee /a %log% echo %@upper[%0] Purging TEMP and BAcKup directories | tee /a %log% if "%date%"=="" goto 80Exit if exist %temp%\*.* attrib -r %temp%\. if exist %bak%\*.* attrib -r %bak%\. if exist %bak%\*.* xcopy %bak%\. %temp% /c:%date% if exist %bak%\*.* del/q %bak% if exist %temp%\*.* xcopy %temp% %bak% /c:%date% if exist %temp%\*.* del/q %temp% dir %bak% /od :80EXit echo %@upper[%0] Defragmenting this drive %1>>%log% defrag %1 /f /se :50Scan echo %@upper[%0] Scanning drive %@upper[%drive%]: | tee /a %log% c:\dos\scandisk %@upper[%drive%]: /autofix /surface /nosummary goto 99exit :90help echo. %+ echo. echo %@upper[%0] - Use as : %@upper[%0] c: delay 5 goto end :99exit copy/q %ram%\chekdriv.log %_boot:\scandisk.log %ram%\chkdrv.log if exist %_boot:\scandisk.log del/q %_boot:\scandisk.log if exist %ram%\chekdriv.log del/q %ram%\chekdriv.log if exist %ram%\chkdrv.log del/q %ram%\chkdrv.log :end endlocal === End cut: CHK_DRV.BTM === As you can see, Christopher was not very detailed with the docs... The main reason I wanted this BTM was to hack apart the CHKDSK section. I don't particularly like doing an indiscriminate CHKDSK /F because I prefer to know if chkdsk found a problem first (and what particular problem) and then determine if the "/F" will correct the problem(s)... Also, depending on the severity of the problem, it may not be entirely necessary to run SCANDISK. ??? Cheers ... Gerald .... One day, I may actually understand all this techie stuff...... --- GoldED+/DPMI32 v1.1.5-040330 * Origin: Archers do it with a quiver. (1:342/512) .