On Thu, 05 Jul 2007 20:59:09 -0000, "Terry Dunlap" <ace_man47@...
>I have two things I need to do.
>1. I need to run through a directory and delete any files over a week
>old. This will be a simple batch file run as a scheduled task.
Use forfiles.exe from Microsoft.
>2. I need to scan through a directory and determine if any new files
>have been added since the last scan. If so, I need to send an email.
If the new files will have a later timestamp you can use this as the last
command in your batch file, to save the state of the folder:
FOR /F "delims=" %%a in (
'dir /b /od /a-d'
) do >c:\bat\datefile.txt echo %%~ta
and when it comes time to comparing the time stamps then this should help:
FOR /F "delims=" %%a in (c:\bat\datefile.txt) do (
if not "%%a"=="%%~ta" echo there are new files
It replies on the fact that new files will have a later timestamp and that
the temp file is not created in the working folder.
You can use BLAT.EXE to send your email.
>These are two independent steps and are not dependent upon each other.
>Any help would be greatly appreciated.