Found this script on the net. It works for the basic reason I downloaded it. But I would like to know a couple things:
- When the script attempt to divide the bytes to KB, MG and GB it errors with Invalid number. Numbers are limited to 32-bits of precision.
- Total Number for Files & Directories are missing the close parenthesis.
CODE:
c:
cd\
@Echo ------------------------------------------------------
@Echo ------------------------------------------------------
@For /F "tokens=*" %%a IN ('"hostname"') do @Set summaryouthost=%%a
@Echo Integrity Check on: %summaryouthost%
@For /F "tokens=*" %%a IN ('"chdir"') do @Set summaryoutchdir=%%a
@Echo Integrity Check For the path: %summaryoutchdir%
@Echo ------------------------------------------------------
@For /F "tokens=*" %%a IN ('"date /T"') do @Set summaryoutsdate=%%a
@Echo Start Date: %summaryoutsdate%
@For /F "tokens=*" %%a IN ('"time /T"') do @Set summaryoutstime=%%a
@Echo Start time: %summaryoutstime%
@Echo ------------------------------------------------------
@For /F "tokens=*" %%a IN ('"dir /s /-c | find "bytes" | find /v "free""') do @Set summaryout=%%a
::@Echo %summaryout%
@For /f "tokens=1,2 delims=)" %%a in ("%summaryout%") do @set filesout=%%a&set sizeout=%%b
@For /f "tokens=*" %%a IN ('"dir /s /-c | find "bytes free""') do @Set summaryoutdir=%%a
::@Echo %summaryoutdir%
@For /f "tokens=1,2 delims=)" %%a in ("%summaryoutdir%") do @set filesoutdir=%%a&set sizeoutdir=%%b
@Set sizeout=%sizeout:bytes=%
::@Echo %sizeout%
@Set sizeout=%sizeout: =%
@set /A inbytes=%sizeout%
@set /A inkb=(%sizeout%) / 1024
@set /A inmb=(%sizeout%) / (1024*1024)
@set /A ingb=(%sizeout%) / (1024*1024*1024)
@For /F "tokens=*" %%a IN ('"date /T"') do @Set summaryoutedate=%%a
@Echo End Date: %summaryoutedate%
@For /F "tokens=*" %%a IN ('"time /T"') do @Set summaryoutetime=%%a
@Echo End time: %summaryoutetime%
@Echo ------------------------------------------------------
@Echo Total Number of Files is:%filesout%
@Echo Total Number of Directory is: %filesoutdir%
@Set sizeoutdir=%sizeoutdir:bytes=%
::@Echo %sizeoutdir%
@Set sizeoutdir=%sizeoutdir: =%
@Echo ------------------------------------------------------
@Echo Total Size is (BY) :%sizeout%
@Echo Total Size is (KB) :%inkb%
@Echo Total Size is (MB) :%inmb%
@Echo Total Size is (GB) :%ingb%
@Echo ------------------------------------------------------
@Echo Free Space is :%sizeoutdir%
@Echo ------------------------------------------------------
@Echo ------------------------------------------------------
OUTPUT:
------------------------------------------------------
------------------------------------------------------
Integrity Check on: Laptop01
Integrity Check For the path: C:\
------------------------------------------------------
Start Date: Sun 10/04/2015
Start time: 12:34 AM
------------------------------------------------------
Invalid number. Numbers are limited to 32-bits of presision.
Invalid number. Numbers are limited to 32-bits of presision.
Invalid number. Numbers are limited to 32-bits of presision.
Invalid number. Numbers are limited to 32-bits of presision.
End Date: Sun 10/04/2015
End time: 12:36 AM
------------------------------------------------------
Total Number of Files is:333914 File(s
Total Number of Directory is: 185869 Dir(s
------------------------------------------------------
Total Size is (BY) :248159912076
Total Size is (KB) :
Total Size is (MB) :
Total Size is (GB) :
------------------------------------------------------
Free Space is :625324642304free
------------------------------------------------------
------------------------------------------------------
Thanks in advance for any help.