<?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: Removing large directories in Linux</title>
	<atom:link href="http://www.allscoop.com/removing-large-directories-in-linux.php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.allscoop.com/removing-large-directories-in-linux.php</link>
	<description>Gadgets - PHP Code - ASP Code - Web Tools - Technology</description>
	<lastBuildDate>Mon, 06 Feb 2012 12:48:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Matz</title>
		<link>http://www.allscoop.com/removing-large-directories-in-linux.php/comment-page-1#comment-8383</link>
		<dc:creator>Matz</dc:creator>
		<pubDate>Wed, 10 Aug 2011 08:59:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.allscoop.com/removing-large-directories-in-linux.php#comment-8383</guid>
		<description>This isn&#039;t a very effective solution:
&lt;code&gt;find . -type f -name “*.htm” -exec rm {} \; &lt;/code&gt;
For a directory with 20000 files, 20000 times shell will execute rm and this will use a lot of CPU and IO time.
A much more efficient solution for directories with many files is:
 &lt;code&gt;find . -type f -name “*.htm” &#124; xargs -l500 rm -f&lt;/code&gt;
This will execute rm for every 500 files, causing much less hassle for the system.
In general, i think using xargs is a whole lot better than -exec in find, and you&#039;d best avoid it when possible.

It may also be used in combination with grep, to clean a folder out of files containing a specific string a-la:
 &lt;code&gt;grep -rF &#039;some string in files&#039; . &#124; xargs -l500 rm&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>This isn&#8217;t a very effective solution:<br />
<code>find . -type f -name “*.htm” -exec rm {} \; </code><br />
For a directory with 20000 files, 20000 times shell will execute rm and this will use a lot of CPU and IO time.<br />
A much more efficient solution for directories with many files is:<br />
 <code>find . -type f -name “*.htm” | xargs -l500 rm -f</code><br />
This will execute rm for every 500 files, causing much less hassle for the system.<br />
In general, i think using xargs is a whole lot better than -exec in find, and you&#8217;d best avoid it when possible.</p>
<p>It may also be used in combination with grep, to clean a folder out of files containing a specific string a-la:<br />
 <code>grep -rF 'some string in files' . | xargs -l500 rm</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: loader</title>
		<link>http://www.allscoop.com/removing-large-directories-in-linux.php/comment-page-1#comment-8344</link>
		<dc:creator>loader</dc:creator>
		<pubDate>Thu, 30 Jun 2011 15:06:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.allscoop.com/removing-large-directories-in-linux.php#comment-8344</guid>
		<description>In case you want remove just htm files...

find . -type f -name &quot;*.htm&quot; -exec rm {} \;</description>
		<content:encoded><![CDATA[<p>In case you want remove just htm files&#8230;</p>
<p>find . -type f -name &#8220;*.htm&#8221; -exec rm {} \;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mitre Box</title>
		<link>http://www.allscoop.com/removing-large-directories-in-linux.php/comment-page-1#comment-1084</link>
		<dc:creator>Mitre Box</dc:creator>
		<pubDate>Thu, 18 Sep 2008 19:51:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.allscoop.com/removing-large-directories-in-linux.php#comment-1084</guid>
		<description>Thanks.  

Saved a couple of hours.</description>
		<content:encoded><![CDATA[<p>Thanks.  </p>
<p>Saved a couple of hours.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

