<?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: MSBuild task to recursively delete all of a folder&#8217;s contents</title>
	<atom:link href="http://blog.coryfoy.com/2007/03/msbuild-task-to-recursively-delete-all-of-a-folders-contents/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.coryfoy.com/2007/03/msbuild-task-to-recursively-delete-all-of-a-folders-contents/</link>
	<description>It&#039;s all about delivering</description>
	<lastBuildDate>Thu, 09 Feb 2012 07:42:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Jose Lamas</title>
		<link>http://blog.coryfoy.com/2007/03/msbuild-task-to-recursively-delete-all-of-a-folders-contents/comment-page-1/#comment-1357</link>
		<dc:creator>Jose Lamas</dc:creator>
		<pubDate>Fri, 19 Aug 2011 02:23:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.cornetdesign.com/?p=170#comment-1357</guid>
		<description>Hi, found this useful!

You can get it to work in a single exec task by using single quotes for the entire exec command and encoding single quotes inside, or viceversa. That is you can write it as follows:

&lt;Exec Command=&#039;for /f &quot;Tokens=*&quot; %%i in (%27dir /ad /b &quot;$(FolderToClean)&quot;%27) do rd /s/q &quot;$(FolderToClean)\%%i&quot;&#039; /&gt;

[hope it reads well once published]

Besides, if the folder also contains files, and you need to get rid of them, as it was my case, an entire CleanFolder target can be written this way:

&lt;Target Name=&quot;CleanFolder&quot; &gt;
	&lt;ItemGroup&gt;
		&lt;ToDelete Include=&quot;$(FolderToClean)\*.*&quot; /&gt;
	&lt;/ItemGroup&gt;
	&lt;Delete Files=&quot;@(ToDelete)&quot; /&gt;

	&lt;Exec Command=&#039;for /f &quot;Tokens=*&quot; %%i in (%27dir /ad /b &quot;$(FolderToClean)&quot;%27) do rd /s/q &quot;$(FolderToClean)\%%i&quot;&#039; /&gt;
&lt;/Target&gt;

Cheers,</description>
		<content:encoded><![CDATA[<p>Hi, found this useful!</p>
<p>You can get it to work in a single exec task by using single quotes for the entire exec command and encoding single quotes inside, or viceversa. That is you can write it as follows:</p>
<p>&lt;Exec Command=&#8217;for /f &#8220;Tokens=*&#8221; %%i in (%27dir /ad /b &#8220;$(FolderToClean)&#8221;%27) do rd /s/q &#8220;$(FolderToClean)\%%i&#8221;&#8216; /&gt;</p>
<p>[hope it reads well once published]</p>
<p>Besides, if the folder also contains files, and you need to get rid of them, as it was my case, an entire CleanFolder target can be written this way:</p>
<p>&lt;Target Name=&#8221;CleanFolder&#8221; &gt;<br />
	&lt;ItemGroup&gt;<br />
		&lt;ToDelete Include=&#8221;$(FolderToClean)\*.*&#8221; /&gt;<br />
	&lt;/ItemGroup&gt;<br />
	&lt;Delete Files=&#8221;@(ToDelete)&#8221; /&gt;</p>
<p>	&lt;Exec Command=&#8217;for /f &#8220;Tokens=*&#8221; %%i in (%27dir /ad /b &#8220;$(FolderToClean)&#8221;%27) do rd /s/q &#8220;$(FolderToClean)\%%i&#8221;&#8216; /&gt;<br />
&lt;/Target&gt;</p>
<p>Cheers,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DONNA WYNN</title>
		<link>http://blog.coryfoy.com/2007/03/msbuild-task-to-recursively-delete-all-of-a-folders-contents/comment-page-1/#comment-1035</link>
		<dc:creator>DONNA WYNN</dc:creator>
		<pubDate>Thu, 25 Mar 2010 00:57:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.cornetdesign.com/?p=170#comment-1035</guid>
		<description>hello great blog yea nice job It sounds like you&#039;re creating problems yourself by trying to solve this issue instead of looking at why their is a problem in the first place.</description>
		<content:encoded><![CDATA[<p>hello great blog yea nice job It sounds like you&#8217;re creating problems yourself by trying to solve this issue instead of looking at why their is a problem in the first place.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cory Foy</title>
		<link>http://blog.coryfoy.com/2007/03/msbuild-task-to-recursively-delete-all-of-a-folders-contents/comment-page-1/#comment-772</link>
		<dc:creator>Cory Foy</dc:creator>
		<pubDate>Thu, 16 Jul 2009 19:44:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.cornetdesign.com/?p=170#comment-772</guid>
		<description>Thanks! Fixed.</description>
		<content:encoded><![CDATA[<p>Thanks! Fixed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://blog.coryfoy.com/2007/03/msbuild-task-to-recursively-delete-all-of-a-folders-contents/comment-page-1/#comment-771</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Thu, 16 Jul 2009 13:28:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.cornetdesign.com/?p=170#comment-771</guid>
		<description>This post has messed up formatting.</description>
		<content:encoded><![CDATA[<p>This post has messed up formatting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ps0a</title>
		<link>http://blog.coryfoy.com/2007/03/msbuild-task-to-recursively-delete-all-of-a-folders-contents/comment-page-1/#comment-191</link>
		<dc:creator>Ps0a</dc:creator>
		<pubDate>Wed, 05 Nov 2008 20:06:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.cornetdesign.com/?p=170#comment-191</guid>
		<description>Very usefull!&lt;br /&gt;tks&lt;br /&gt;&lt;br /&gt;I use that in my site , ok?</description>
		<content:encoded><![CDATA[<p>Very usefull!<br />tks</p>
<p>I use that in my site , ok?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.coryfoy.com/2007/03/msbuild-task-to-recursively-delete-all-of-a-folders-contents/comment-page-1/#comment-192</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sat, 05 Apr 2008 04:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.cornetdesign.com/?p=170#comment-192</guid>
		<description>Using that &#039;DeleteAppSettingsFiles&#039; as is currently has two problems. 1. it will not delete read only files, 2. It will not delete the folders, only files.&lt;br /&gt;&lt;br /&gt;The CleanFolder task provides an easy mechanism to do this.</description>
		<content:encoded><![CDATA[<p>Using that &#8216;DeleteAppSettingsFiles&#8217; as is currently has two problems. 1. it will not delete read only files, 2. It will not delete the folders, only files.</p>
<p>The CleanFolder task provides an easy mechanism to do this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FreeToDev</title>
		<link>http://blog.coryfoy.com/2007/03/msbuild-task-to-recursively-delete-all-of-a-folders-contents/comment-page-1/#comment-193</link>
		<dc:creator>FreeToDev</dc:creator>
		<pubDate>Tue, 01 Apr 2008 16:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.cornetdesign.com/?p=170#comment-193</guid>
		<description>or use the CleanFolder task in the Microsoft SDC Tasks Library: http://www.codeplex.com/sdctasks</description>
		<content:encoded><![CDATA[<p>or use the CleanFolder task in the Microsoft SDC Tasks Library: <a href="http://www.codeplex.com/sdctasks" rel="nofollow">http://www.codeplex.com/sdctasks</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.coryfoy.com/2007/03/msbuild-task-to-recursively-delete-all-of-a-folders-contents/comment-page-1/#comment-194</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Fri, 05 Oct 2007 10:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.cornetdesign.com/?p=170#comment-194</guid>
		<description>Cory what about &lt;br /&gt;&lt;br /&gt;&amp;ltItemGroup;&gt;&lt;br /&gt;    &amp;ltSettingsFiles; Include=&quot;$(ProgramFiles)\App\Settings\**&quot;/&gt;&lt;br /&gt;  &lt;/ItemGroup&gt;&lt;br /&gt;&lt;br /&gt;&amp;ltTarget; Name=&quot;DeleteAppSettingsFiles&quot;&gt;&lt;br /&gt;    &amp;ltDelete; Files=&quot;@(SettingsFiles)&quot; /&gt;&lt;br /&gt;  &lt;/Target&gt;</description>
		<content:encoded><![CDATA[<p>Cory what about </p>
<p>&#038;ltItemGroup;><br />    &#038;ltSettingsFiles; Include=&#8221;$(ProgramFiles)\App\Settings\**&#8221;/><br />  &lt;/ItemGroup></p>
<p>&ltTarget; Name=&#8221;DeleteAppSettingsFiles&#8221;><br />    &ltDelete; Files=&#8221;@(SettingsFiles)&#8221; /><br />  &lt;/Target></p>
]]></content:encoded>
	</item>
</channel>
</rss>

