I need a batch file that monitors additions to my Downloads folder, but only new additions. Something like this:
:START
NumOldFiles = GetNumberOfFilesOld
Delay_30_Seconds
NumNewFiles = GetNumberOfFilesNew
if(NumFilesOld < NumFilesNew)
run_another_batch_file_I_wrote
goto START
else
goto START
I do not want to count subfolders, just the folders and files in the directory.
I have been looking at this:
dir "C:folder" /b/a |find /v /c "::"
but I don't know how to store this value and test it as < or >.
Maybe there is a better way to do this, but I can't think of one right now. Maybe maintain a list and if the new list has a new file run the batch script, replace the old list with the new list, I'm not really sure how to go about this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…