 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: MS-DOS code to delete old Files</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/ms-dos-code-to-delete-old-files/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/ms-dos-code-to-delete-old-files/</link>
	<description></description>
	<lastBuildDate>Sat, 25 May 2013 00:24:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: durgaprasad72</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/ms-dos-code-to-delete-old-files/#comment-106400</link>
		<dc:creator>durgaprasad72</dc:creator>
		<pubDate>Wed, 04 Apr 2012 07:28:24 +0000</pubDate>
		<guid isPermaLink="false">#comment-106400</guid>
		<description><![CDATA[Hi,

I am trying to delete folders which are 3 days old. Folder size is more than 400MB. There are around 6-7 folders in this location. But the script i tried is deleting 1-2 folders.
I have used the below code in my VBS file.

strFolderPath = &quot;C:TestBuilds&quot;    &#039;Folder Path 
strLogFolderPath=&quot;C:TestBuildsLogs&quot;   
NumberOfDays = 3 		&#039;Anything older than this many days will be removed

On Error Resume Next
Dim fso,objFolder,objFile,objSubfolder,objLogFolder
Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set objFolder = fso.GetFolder(strFolderPath)
Set objLogFolder = fso.GetFolder(strLogFolderPath)

&#039;DELETE all subfolders in Folder Path older than Number of  days
For Each objSubfolder In objFolder.Subfolders
	If objSubFolder.Name = &quot;Logs&quot; Then
&#039;		Set objSubFolder= Nothing		
    Else If DateDiff(&quot;d&quot;, objSubfolder.DateCreated,Now) &gt; NumberOfDays Then
         objSubfolder.Delete True 
	 Wait 20
      End If
	End If	
Next

&#039;Delete all the folders in Log folder
For Each objSubfolder In objLogFolder.Subfolders
	If DateDiff(&quot;d&quot;, objSubfolder.DateCreated,Now) &gt; NumberOfDays*5 Then
         objSubfolder.Delete True      
     End If	
Next

Set fso=Nothing
Set objFolder=Nothing
Set objLogFolder=Nothing
Set objSubfolder=Nothing

Can anyone suggest me on this.

- Durga Prasad]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am trying to delete folders which are 3 days old. Folder size is more than 400MB. There are around 6-7 folders in this location. But the script i tried is deleting 1-2 folders.<br />
I have used the below code in my VBS file.</p>
<p>strFolderPath = &#8220;C:TestBuilds&#8221;    &#8216;Folder Path<br />
strLogFolderPath=&#8221;C:TestBuildsLogs&#8221;<br />
NumberOfDays = 3 		&#8216;Anything older than this many days will be removed</p>
<p>On Error Resume Next<br />
Dim fso,objFolder,objFile,objSubfolder,objLogFolder<br />
Set fso = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br />
Set objFolder = fso.GetFolder(strFolderPath)<br />
Set objLogFolder = fso.GetFolder(strLogFolderPath)</p>
<p>&#8216;DELETE all subfolders in Folder Path older than Number of  days<br />
For Each objSubfolder In objFolder.Subfolders<br />
	If objSubFolder.Name = &#8220;Logs&#8221; Then<br />
&#8216;		Set objSubFolder= Nothing<br />
    Else If DateDiff(&#8220;d&#8221;, objSubfolder.DateCreated,Now) &gt; NumberOfDays Then<br />
         objSubfolder.Delete True<br />
	 Wait 20<br />
      End If<br />
	End If<br />
Next</p>
<p>&#8216;Delete all the folders in Log folder<br />
For Each objSubfolder In objLogFolder.Subfolders<br />
	If DateDiff(&#8220;d&#8221;, objSubfolder.DateCreated,Now) &gt; NumberOfDays*5 Then<br />
         objSubfolder.Delete True<br />
     End If<br />
Next</p>
<p>Set fso=Nothing<br />
Set objFolder=Nothing<br />
Set objLogFolder=Nothing<br />
Set objSubfolder=Nothing</p>
<p>Can anyone suggest me on this.</p>
<p>- Durga Prasad</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jutpro</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/ms-dos-code-to-delete-old-files/#comment-69273</link>
		<dc:creator>jutpro</dc:creator>
		<pubDate>Tue, 20 Oct 2009 20:40:54 +0000</pubDate>
		<guid isPermaLink="false">#comment-69273</guid>
		<description><![CDATA[Ok, I had overlooked the link and did not realize I had to do a download.

Thank you Troy and Labnuke99.]]></description>
		<content:encoded><![CDATA[<p>Ok, I had overlooked the link and did not realize I had to do a download.</p>
<p>Thank you Troy and Labnuke99.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Troy Tate</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/ms-dos-code-to-delete-old-files/#comment-69270</link>
		<dc:creator>Troy Tate</dc:creator>
		<pubDate>Tue, 20 Oct 2009 20:05:56 +0000</pubDate>
		<guid isPermaLink="false">#comment-69270</guid>
		<description><![CDATA[Click on the &lt;a href=&quot;http://winhlp.com/node/180&quot;&gt;forfiles&lt;/a&gt; link in the answer above. You will need to download the utility.]]></description>
		<content:encoded><![CDATA[<p>Click on the <a href="http://winhlp.com/node/180">forfiles</a> link in the answer above. You will need to download the utility.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.014 seconds using memcached
Object Caching 296/299 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-25 03:33:08 -->