10.3: See a quick view of folder-by-folder disk utilization

Oct 25, '03 02:41:00AM

Contributed by: robg

In the process of migrating data from the old machine to the new machine, I was surprised to see that my user's Documents folder was 2.0+gb in size. However, the presence of 50+ folders in that directory made it tough to figure out exactly where the problem might lie (doing a Get Info or Inspector window 50 times over gets old, quick).

Time for a command line rescue ... and though this hint works in 10.2 (and probably earlier), it's better in Panther. To see a list of disk space by directory, you first need to cd into the directory you wish to study (Documents, in my case), and then issue this command:

 % du -ksh *
If you're not using Panther, the h on the end won't do anything ... but in Panther, it forces the output into "human readable" mode (KBytes and MBytes). The k option creates 1KB blocks for counting, and the s option creates one output line for each file in the directory. In my case, I saw this (trimmed for length):
% du -ksh *
 18M    848077.tif
135M    Kylie related
786M    Segway video.dvdproj
156K    Servers
  0B    Sound 
528K    Untitled Animation
165M    iChats
 82M    icons
1.2M    infocom
942M    macosxhints
 87M    home_photos_2002
 22M    screens
5.2M    stuff
137M    textures
This made it very easy to identify the suspect "large" directories and either clean them out, trash them, or find room for them on the new machine. I'm sure there are many variations on this theme (comments, anyone?), but this one works quite nicely, especially with the newer version of du in Panther.

Comments (15)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20031025024114429