Steve
10-25-2005, 03:06 AM
Hi All,
Does anyone know if there is any utility or script I can use to delete
folders in X number of days?
For example: These folders are automatically created based on date.
20051013
20051014
20051015
20051016
20051017
..
..
etc..
Thannks,
Steve
Dave Patrick
10-25-2005, 02:10 PM
This link may help.
http://groups.google.com/group/microsoft.public.scripting.vbscript/msg/b6e7f199e49a6ddb?hl=en&
--
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
"Steve" wrote:
>
> Hi All,
>
> Does anyone know if there is any utility or script I can use to delete
> folders in X number of days?
>
> For example: These folders are automatically created based on date.
>
> 20051013
> 20051014
> 20051015
> 20051016
> 20051017
> .
> .
> etc..
>
>
> Thannks,
>
> Steve
>
Jerold Schulman
10-25-2005, 02:28 PM
On Mon, 24 Oct 2005 19:06:02 -0700, "Steve" <Steve@discussions.microsoft.com> wrote:
>
>Hi All,
>
>Does anyone know if there is any utility or script I can use to delete
>folders in X number of days?
>
>For example: These folders are automatically created based on date.
>
>20051013
>20051014
>20051015
>20051016
>20051017
>.
>.
>etc..
>
>
>Thannks,
>
>Steve
See tip 9828 » How can I retrieve the current year, month, day, hour, minutes, second, GMT offset, and Daylight Saving Time flag?
in the 'Tips & Tricks' at http://www.jsifaq.com
See tip 0721 » General purpose date math routine.
@echo off
if {%2}=={} @echo DelDtFldr X FldrPath&goto :EOF
if %1 NEQ +%1 @echo DelDtFldr X FldrPath&goto :EOF
if not exist %2 @echo DelDtFldr X FldrPath&goto :EOF
setlocal
set /a X=10000%1%%10000
set fldr=%2#
set fldr=%fldr:"=%
set fldr=%fldr:\#=%
set fldr=%fldr:#=%
Call DateTime YYYY MM DD HH MN SS oGMT DST
Call JSIDateM %YYYY% %MM% %DD% - %X%
for /f "Tokens=*" %%a in ('dir /b /ad "%fldr%"') do (
if "%%a" LEQ "%AYMD%" @echo RD /s /q "%fldr%\%%a"
)
endlocal
Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com