<?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: Tracking down used disk space: Follow largest directories</title>
	<atom:link href="http://dancingpenguinsoflight.com/2009/01/tracking-down-used-disk-space-follow-largest-directories/feed/" rel="self" type="application/rss+xml" />
	<link>http://dancingpenguinsoflight.com/2009/01/tracking-down-used-disk-space-follow-largest-directories/</link>
	<description></description>
	<lastBuildDate>Sat, 19 May 2012 07:40:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Brad</title>
		<link>http://dancingpenguinsoflight.com/2009/01/tracking-down-used-disk-space-follow-largest-directories/comment-page-1/#comment-10859</link>
		<dc:creator>Brad</dc:creator>
		<pubDate>Wed, 13 Jan 2010 18:47:24 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=414#comment-10859</guid>
		<description>Just wanted to say thanks for sharing!</description>
		<content:encoded><![CDATA[<p>Just wanted to say thanks for sharing!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samuel Huckins</title>
		<link>http://dancingpenguinsoflight.com/2009/01/tracking-down-used-disk-space-follow-largest-directories/comment-page-1/#comment-705</link>
		<dc:creator>Samuel Huckins</dc:creator>
		<pubDate>Thu, 19 Feb 2009 03:08:09 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=414#comment-705</guid>
		<description>Updated to include size rounding and proper error checking. Worked fine in / on several *nix boxes.

Thanks Dorantor!</description>
		<content:encoded><![CDATA[<p>Updated to include size rounding and proper error checking. Worked fine in / on several *nix boxes.</p>
<p>Thanks Dorantor!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samuel Huckins</title>
		<link>http://dancingpenguinsoflight.com/2009/01/tracking-down-used-disk-space-follow-largest-directories/comment-page-1/#comment-702</link>
		<dc:creator>Samuel Huckins</dc:creator>
		<pubDate>Wed, 18 Feb 2009 18:05:09 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=414#comment-702</guid>
		<description>You are right, it definitely needs some error handling. Thanks for the patch! I will give this script some more attention, adding error-handling and rounding, and make it available.

Sorry about the formatting, I am just using the Ajax Edit Comments plugin right now. I will try to get a better commenting system in place.</description>
		<content:encoded><![CDATA[<p>You are right, it definitely needs some error handling. Thanks for the patch! I will give this script some more attention, adding error-handling and rounding, and make it available.</p>
<p>Sorry about the formatting, I am just using the Ajax Edit Comments plugin right now. I will try to get a better commenting system in place.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dorantor</title>
		<link>http://dancingpenguinsoflight.com/2009/01/tracking-down-used-disk-space-follow-largest-directories/comment-page-1/#comment-700</link>
		<dc:creator>Dorantor</dc:creator>
		<pubDate>Wed, 18 Feb 2009 16:29:10 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=414#comment-700</guid>
		<description>eeek! where is formatting?!! :(</description>
		<content:encoded><![CDATA[<p>eeek! where is formatting?!! <img src='http://dancingpenguinsoflight.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dorantor</title>
		<link>http://dancingpenguinsoflight.com/2009/01/tracking-down-used-disk-space-follow-largest-directories/comment-page-1/#comment-699</link>
		<dc:creator>Dorantor</dc:creator>
		<pubDate>Wed, 18 Feb 2009 16:28:01 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=414#comment-699</guid>
		<description>When I tried to use this script it doesn&#039;t works w/o error handling. Small, quick&#039;n&#039;dirty hack solves my problem :) I leave commented simple example how errors can be handled for any who would like to write it.
You may also note - I added rounding to returned values, so now results are more readable.

[code]
def get_dir_size(dir):
    &quot;&quot;&quot; 
    Get the size of the directory passed.
    &quot;&quot;&quot;
    dir_size = 0
    for (path, dirs, files) in os.walk(dir):
        for file in files:
            filename = os.path.join(path, file)
            try:
                dir_size += os.path.getsize(filename)
            except OSError,e:
                dir_size += 0 # just do nothing. for now.
#                if errno.ENOENT == e.errno: # http://docs.python.org/library/errno.html
#                    print os.strerror(e.errno) + &quot; (&quot; + e.filename + &quot;)&quot;
    return round(dir_size / (1024*1024.0), 2)
[/code]

BTW! You will (possibly) need this:

[code]
import errno
[/code]</description>
		<content:encoded><![CDATA[<p>When I tried to use this script it doesn&#8217;t works w/o error handling. Small, quick&#8217;n'dirty hack solves my problem <img src='http://dancingpenguinsoflight.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I leave commented simple example how errors can be handled for any who would like to write it.<br />
You may also note &#8211; I added rounding to returned values, so now results are more readable.</p>
<p>[code]<br />
def get_dir_size(dir):<br />
    """<br />
    Get the size of the directory passed.<br />
    """<br />
    dir_size = 0<br />
    for (path, dirs, files) in os.walk(dir):<br />
        for file in files:<br />
            filename = os.path.join(path, file)<br />
            try:<br />
                dir_size += os.path.getsize(filename)<br />
            except OSError,e:<br />
                dir_size += 0 # just do nothing. for now.<br />
#                if errno.ENOENT == e.errno: # <a href="http://docs.python.org/library/errno.html" rel="nofollow">http://docs.python.org/library/errno.html</a><br />
#                    print os.strerror(e.errno) + " (" + e.filename + ")"<br />
    return round(dir_size / (1024*1024.0), 2)<br />
[/code]</p>
<p>BTW! You will (possibly) need this:</p>
<p>[code]<br />
import errno<br />
[/code]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Easy and informative: Call graphs in Python &#124; tail -f findings.out</title>
		<link>http://dancingpenguinsoflight.com/2009/01/tracking-down-used-disk-space-follow-largest-directories/comment-page-1/#comment-485</link>
		<dc:creator>Easy and informative: Call graphs in Python &#124; tail -f findings.out</dc:creator>
		<pubDate>Tue, 20 Jan 2009 05:28:26 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=414#comment-485</guid>
		<description>[...] in the folder where you ran the script. I added these lines around the main function of the follow-largest-directories script I blogged about recently, right after all the option parsing stuff. Here was the [...]</description>
		<content:encoded><![CDATA[<p>[...] in the folder where you ran the script. I added these lines around the main function of the follow-largest-directories script I blogged about recently, right after all the option parsing stuff. Here was the [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

