<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic file deletion script depending on dates in Operating System - Microsoft</title>
    <link>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984095#M8014</link>
    <description>I need to delete logs older than X days.&lt;BR /&gt;&lt;BR /&gt;Log file names go like this: ex070401.log&lt;BR /&gt;&lt;BR /&gt;I was considering something like this .bat here: &lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=890651" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=890651&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;But, this will not do because I need to delete the files accordig to the modification date.&lt;BR /&gt;&lt;BR /&gt;Thank you much.&lt;BR /&gt;&lt;BR /&gt;Edgar.</description>
    <pubDate>Wed, 18 Apr 2007 11:05:29 GMT</pubDate>
    <dc:creator>Edgar Zapata</dc:creator>
    <dc:date>2007-04-18T11:05:29Z</dc:date>
    <item>
      <title>file deletion script depending on dates</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984095#M8014</link>
      <description>I need to delete logs older than X days.&lt;BR /&gt;&lt;BR /&gt;Log file names go like this: ex070401.log&lt;BR /&gt;&lt;BR /&gt;I was considering something like this .bat here: &lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=890651" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=890651&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;But, this will not do because I need to delete the files accordig to the modification date.&lt;BR /&gt;&lt;BR /&gt;Thank you much.&lt;BR /&gt;&lt;BR /&gt;Edgar.</description>
      <pubDate>Wed, 18 Apr 2007 11:05:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984095#M8014</guid>
      <dc:creator>Edgar Zapata</dc:creator>
      <dc:date>2007-04-18T11:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: file deletion script depending on dates</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984096#M8015</link>
      <description>Check this&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.michna.com/software.htm#DelOld" target="_blank"&gt;http://www.michna.com/software.htm#DelOld&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You can download the source code. Is a tool for removing files based on the age.&lt;BR /&gt;&lt;BR /&gt;While is unsupported, you can check the source code and modify to fit your requirements.&lt;BR /&gt;&lt;BR /&gt;Another tool you can try is "obsolete"&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://users.aol.com/pasacaca/obsolete/obsolete.zip" target="_blank"&gt;http://users.aol.com/pasacaca/obsolete/obsolete.zip&lt;/A&gt;</description>
      <pubDate>Wed, 18 Apr 2007 12:12:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984096#M8015</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2007-04-18T12:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: file deletion script depending on dates</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984097#M8016</link>
      <description>There a CMD file I've used before, for the same sort of use.  Change it as needed.&lt;BR /&gt;------------------------------&lt;BR /&gt;REM @echo off&lt;BR /&gt;for /f "tokens=2,3,4 delims=/ " %%i in ('echo %date%') do (&lt;BR /&gt;set /A my_day=%%j-7&lt;BR /&gt;set my_month=%%i&lt;BR /&gt;set my_year=%%k&lt;BR /&gt;)&lt;BR /&gt;if %my_day% LEQ 0 set /A my_month-=1&lt;BR /&gt;if %my_month%==0 (&lt;BR /&gt;set my_month=12&lt;BR /&gt;set /A my_year-=1&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;if %my_day% EQU 0 ( &lt;BR /&gt;if %my_month%==12 set /A my_day=31&lt;BR /&gt;if %my_month%==11 set /A my_day=30&lt;BR /&gt;if %my_month%==10 set /A my_day=31&lt;BR /&gt;if %my_month%==9 set /A my_day=30&lt;BR /&gt;if %my_month%==8 set /A my_day=31&lt;BR /&gt;if %my_month%==7 set /A my_day=31&lt;BR /&gt;if %my_month%==6 set /A my_day=30&lt;BR /&gt;if %my_month%==5 set /A my_day=31&lt;BR /&gt;if %my_month%==4 set /A my_day=30&lt;BR /&gt;if %my_month%==3 set /A my_day=31&lt;BR /&gt;if %my_month%==2 set /A my_day=28&lt;BR /&gt;if %my_month%==1 set /A my_day=31&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;if %my_day% LSS 0 ( &lt;BR /&gt;if %my_month%==12 set /A my_day=31+%my_day%&lt;BR /&gt;if %my_month%==11 set /A my_day=30+%my_day%&lt;BR /&gt;if %my_month%==10 set /A my_day=31+%my_day%&lt;BR /&gt;if %my_month%==9 set /A my_day=30+%my_day%&lt;BR /&gt;if %my_month%==8 set /A my_day=31+%my_day%&lt;BR /&gt;if %my_month%==7 set /A my_day=31+%my_day%&lt;BR /&gt;if %my_month%==6 set /A my_day=30+%my_day%&lt;BR /&gt;if %my_month%==5 set /A my_day=31+%my_day%&lt;BR /&gt;if %my_month%==4 set /A my_day=30+%my_day%&lt;BR /&gt;if %my_month%==3 set /A my_day=31+%my_day%&lt;BR /&gt;if %my_month%==2 set /A my_day=28+%my_day%&lt;BR /&gt;if %my_month%==1 set /A my_day=31+%my_day%&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;set sysdate=%my_year%/%my_month%/%my_day%&lt;BR /&gt;set filedate=%my_day%-%my_month%-%my_year%&lt;BR /&gt;set my_file = info_%filedate%&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;echo %sysdate%&lt;BR /&gt;echo %filedate%&lt;BR /&gt;pause&lt;BR /&gt;----------------------&lt;BR /&gt;&lt;BR /&gt;Note that using Powershell would probably be your BEST choice, and it's free from MS.&lt;BR /&gt;&lt;A href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target="_blank"&gt;http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Jon</description>
      <pubDate>Thu, 19 Apr 2007 13:22:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984097#M8016</guid>
      <dc:creator>Jon Finley</dc:creator>
      <dc:date>2007-04-19T13:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: file deletion script depending on dates</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984098#M8017</link>
      <description>Oops....&lt;BR /&gt;&lt;BR /&gt;replace the one section with this:  No '+'&lt;BR /&gt;--------------------------------------&lt;BR /&gt;if %my_day% LSS 0 ( &lt;BR /&gt;if %my_month%==12 set /A my_day=31%my_day% &lt;BR /&gt;if %my_month%==11 set /A my_day=30%my_day% &lt;BR /&gt;if %my_month%==10 set /A my_day=31%my_day% &lt;BR /&gt;if %my_month%==9 set /A my_day=30%my_day% &lt;BR /&gt;if %my_month%==8 set /A my_day=31%my_day% &lt;BR /&gt;if %my_month%==7 set /A my_day=31%my_day% &lt;BR /&gt;if %my_month%==6 set /A my_day=30%my_day% &lt;BR /&gt;if %my_month%==5 set /A my_day=31%my_day% &lt;BR /&gt;if %my_month%==4 set /A my_day=30%my_day% &lt;BR /&gt;if %my_month%==3 set /A my_day=31%my_day% &lt;BR /&gt;if %my_month%==2 set /A my_day=28%my_day% &lt;BR /&gt;if %my_month%==1 set /A my_day=31%my_day% &lt;BR /&gt;) &lt;BR /&gt;----------------------------&lt;BR /&gt;&lt;BR /&gt;I read through me script quickly, and thinking that I had made a mistake, added in the '+' signs.  But the number being checked would be negative, so the subtraction will work fine.&lt;BR /&gt;&lt;BR /&gt;Jon</description>
      <pubDate>Thu, 19 Apr 2007 13:26:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984098#M8017</guid>
      <dc:creator>Jon Finley</dc:creator>
      <dc:date>2007-04-19T13:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: file deletion script depending on dates</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984099#M8018</link>
      <description>Jon,&lt;BR /&gt;Thank you much.&lt;BR /&gt;&lt;BR /&gt;I am testing it.&lt;BR /&gt;But this is for sure what I wanted.&lt;BR /&gt;&lt;BR /&gt;I didn't know how to use the tokens in a FOR loop.&lt;BR /&gt;&lt;BR /&gt;Tnks.</description>
      <pubDate>Fri, 20 Apr 2007 08:13:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984099#M8018</guid>
      <dc:creator>Edgar Zapata</dc:creator>
      <dc:date>2007-04-20T08:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: file deletion script depending on dates</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984100#M8019</link>
      <description>I know there must be a way to do it a lot better.&lt;BR /&gt;I didn't know how to use the tokens or delims.  This is very useful.  &lt;BR /&gt;&lt;BR /&gt;What I finally did was this:&lt;BR /&gt;&lt;BR /&gt;@echo off&lt;BR /&gt;for /f "tokens=1,2 delims=/" %%i in ('date /t') do (&lt;BR /&gt;set _d=%%i&lt;BR /&gt;set _m=%%j&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;if %_d% EQU 5 goto 26a31:&lt;BR /&gt;if %_d% EQU 6 goto 26a31:&lt;BR /&gt;if %_d% EQU 7 goto 26a31:&lt;BR /&gt;if %_d% EQU 8 goto 26a31:&lt;BR /&gt;if %_d% EQU 9 goto 1a5:&lt;BR /&gt;if %_d% EQU 10 goto 1a5:&lt;BR /&gt;if %_d% EQU 11 goto 1a5:&lt;BR /&gt;if %_d% EQU 12 goto 1a5:&lt;BR /&gt;if %_d% EQU 13 goto 1a5:&lt;BR /&gt;if %_d% EQU 14 goto 6a10:&lt;BR /&gt;if %_d% EQU 15 goto 6a10:&lt;BR /&gt;if %_d% EQU 16 goto 6a10:&lt;BR /&gt;if %_d% EQU 17 goto 6a10:&lt;BR /&gt;if %_d% EQU 18 goto 6a10:&lt;BR /&gt;if %_d% EQU 19 goto 11a15:&lt;BR /&gt;if %_d% EQU 20 goto 11a15:&lt;BR /&gt;if %_d% EQU 21 goto 11a15:&lt;BR /&gt;if %_d% EQU 22 goto 11a15:&lt;BR /&gt;if %_d% EQU 23 goto 16a20:&lt;BR /&gt;if %_d% EQU 24 goto 16a20:&lt;BR /&gt;if %_d% EQU 25 goto 16a20:&lt;BR /&gt;if %_d% EQU 26 goto 16a20:&lt;BR /&gt;if %_d% EQU 27 goto 16a20:&lt;BR /&gt;if %_d% EQU 28 goto 21a25:&lt;BR /&gt;if %_d% EQU 29 goto 21a25:&lt;BR /&gt;if %_d% EQU 30 goto 21a25:&lt;BR /&gt;if %_d% EQU 31 goto 21a25:&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;:26a31&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????26.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????27.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????28.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????29.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????30.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????31.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????26.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????27.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????28.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????29.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????30.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????31.log&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;:1a5&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????01.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????02.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????03.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????04.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????05.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????01.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????02.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????03.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????04.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????05.log&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;:6a10&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????06.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????07.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????08.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????09.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????10.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????06.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????07.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????08.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????09.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????10.log&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;:11a15&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????11.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????12.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????13.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????14.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????15.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????11.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????12.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????13.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????14.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????15.log&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;:16a20&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????16.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????17.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????18.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????19.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????20.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????16.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????17.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????18.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????19.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????20.log&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;:21a25&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????21.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????22.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????23.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????24.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC1\ex????25.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????21.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????22.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????23.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????24.log&lt;BR /&gt;del \\%computername%\e$\LogFiles\SMTPSVC2\ex????25.log&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;At least, I got it working.&lt;BR /&gt;I still would like to improve it.  &lt;BR /&gt;If anyone could shed some light as to how to, I would appreciate it.&lt;BR /&gt;&lt;BR /&gt;Tnks.&lt;BR /&gt;Edgar.</description>
      <pubDate>Wed, 09 May 2007 10:13:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/file-deletion-script-depending-on-dates/m-p/3984100#M8019</guid>
      <dc:creator>Edgar Zapata</dc:creator>
      <dc:date>2007-05-09T10:13:50Z</dc:date>
    </item>
  </channel>
</rss>

