Removing Files Older than a certain date - Windows NT

This is a discussion on Removing Files Older than a certain date - Windows NT ; Hi All, Is there a simple way to write a DOS script to remove files older than a certain number of days? Thanks, Sandeep Madduri...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Removing Files Older than a certain date

  1. Removing Files Older than a certain date

    Hi All,

    Is there a simple way to write a DOS script to remove files older than
    a certain number of days?

    Thanks,
    Sandeep Madduri


  2. Re: Removing Files Older than a certain date

    sandeepmadduri@gmail.com wrote...

    >Is there a simple way to write a DOS script to remove files older than
    >a certain number of days?


    DOS script is so "simple" to achieve this.
    You can google your title and would be able to find some suggestions.

    Here is another way which need some tools.

    "UnxUtils" is a set of native Win32 utilities (e.g. find, rm, xargs)
    ported from GNU counterparts.

    http://unxutils.sourceforge.net/UnxUtils.zip

    Fetch it, unzip to say, c:\Unxutils\ and include the later in your %PATH%.

    Then, e.g., the following cmd sequence

    find f:\tmp2 ! ( -type d ) -mtime +4 | xargs rm -i

    would do

    1) find recursively from the folder f:\tmp2
    2) for entities not being directory (or sub-directory)
    3) with modification time greater than 4 days
    4) pipe the result list to the "rm" utility via "xargs";
    and prompt before delete the resultant files.

    Hope this help.


  3. Re: Removing Files Older than a certain date

    sandeepmadduri@gmail.com wrote...

    >Is there a simple way to write a DOS script to remove files older than
    >a certain number of days?


    DOS script is _NOT_ so "simple" to achieve this unless you are fluent
    in DOS or NT scripting.

    You can google your title and would be able to find some suggestions.

    Here is another way which need some tools.

    "UnxUtils" is a set of native Win32 utilities (e.g. find, rm, xargs)
    ported from GNU counterparts.

    http://unxutils.sourceforge.net/UnxUtils.zip

    Fetch it, unzip to say, c:\Unxutils\ and include the later in your %PATH%.

    Then, e.g., the following cmd sequence

    find f:\tmp2 ! ( -type d ) -mtime +4 | xargs rm -i

    would do

    1) find recursively from the folder f:\tmp2
    2) for entities not being directory (or sub-directory)
    3) with modification time greater than 4 days
    4) pipe the result list to the "rm" utility via "xargs";
    and prompt before delete the resultant files.

    Hope this help.



+ Reply to Thread