I am attempting to loop thru a main directory check the the subfolders for a file called log.txt. The log file contains the folder size. If the log file does not exist I want to write the directory's side to the log file and save it. The sub directories being checked are fairly small to start with, maybe 550 bytes, but when I check the size with script it returns 0. Here is part of the script. If I check the folder properties it displays approx 550. The next step would be to retrieve the value in the log file if it exist and compare it to the current size of the folder to see if it is changing.
Code: Select all
setLocal EnableDelayedExpansion
FOR /R c:\main %%G in (.) DO (
Pushd %%G
Echo now in %%G
IF EXIST log.txt. (
ECHO FILE HERE
) ELSE (
ECHO FILE IS MISSING
ECHO CREATE LOG FILE
echo DIR %%G SIZE IS: %%~zG
echo %%G~zG>log.txt
)
Popd )
Echo "back home"
)