Hello, I've come up with another problem... I'm trying to find the total size of all the files in a directory (recursive) that have a certain extension. I've come up with the code, executed it, everything's perfect. UNTIL it goes beyond the 32bit limit of the variables.
here's my code:
set /p directory=Which Directory?
echo %directory% > output.txt
echo step1: directory listing
dir %directory% /s /-c > temp1.txt
echo step2: refining directory listing
:: THIS STEP JUST SAVES ALL LINES THAT HAVE A DATE AND REMOVES ALL THE OTHER CRAP AND THEN REMOVES ALL THE DIRECTORY LISTINGS
Find /I "/200" temp1.txt > temp2.txt
Find /I "/199" temp1.txt >> temp2.txt
Find /I "/198" temp1.txt >> temp2.txt
Del temp1.txt
Find /I /v "<DIR>" temp2.txt > temp3.txt
Del temp2.txt
echo step3: search files
echo starting .doc
Find /I ".doc" temp3.txt > temp_doc.txt
set doc_size = 0
set %%A = 0
For /F "tokens=4" %%A in (temp_doc.txt) do (set /a doc_size+=%%A)
echo .doc size = %doc_size% bytes >> output.txt
del temp_doc.txt
I'm doing this for a bunch of different file types and the problem isn't necessarily with the .doc files but the email collections (.pst) and other groups of files that are bigger than 2 gig.
So my problem comes when i have a file that is for example: 29332915648 bytes. this number returns as a negative number which messes everything up. The problem also comes up when adding up all the sizes, the variable goes beyond 2 gigs (2147483647 bytes since 4294967295 is the 32bit range and anything over 2147483647 comes up negative.)
You guys have been so helpful and I'm hoping you might be able to give me a hand, otherwise I may have to move on to vbscript or powershell for this