Loading ...
Sorry, an error occurred while loading the content.

FTP woes

Expand Messages
  • Terry Dunlap
    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
    Message 1 of 2 , Jul 5, 2007
    • 0 Attachment
      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.

      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.

      These are two independent steps and are not dependent upon each other.
      Any help would be greatly appreciated.
    • foxidrive
      On Thu, 05 Jul 2007 20:59:09 -0000, Terry Dunlap ... Use forfiles.exe from Microsoft. ... If the new files will have a later timestamp
      Message 2 of 2 , Jul 5, 2007
      • 0 Attachment
        On Thu, 05 Jul 2007 20:59:09 -0000, "Terry Dunlap" <ace_man47@...>
        wrote:

        >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:

        @echo off
        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:

        @echo off
        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.
      Your message has been successfully submitted and would be delivered to recipients shortly.