PDA

View Full Version : How to determine disk space hogs?


agrieco
2-1-04, 10:41 AM
All,

Is there anyway to get a breakdown of what files and directories are using what disk space on my account? I am trying to figure out where all the space went :(

thanks
anthony

YvetteKuhns
2-1-04, 10:51 AM
If you don't have your files on your computer, you can download them and see how many files are in each folder. If you have a forum, guestbook or other scripts that create files, that can take more space that you may not have considered.

Also remember that error logs and webstats take space and can be downloaded and/or deleted. Most importantly, don't use Front Page Extensions.

stevel
2-1-04, 12:08 PM
Any halfway decent FTP client will display the file sizes without downloading. Even MSIE - select Details mode.

YvetteKuhns
2-1-04, 12:55 PM
The ftp programs show the file size for each file. I think Anthony wanted to get a group total for each file type. So if you have an image folder and find that 100 files have a total of 5000 k, then you get an idea where to clean house!

serina
2-1-04, 02:56 PM
my boss says try this script:

<?php
$basedir = '/www/u/username/';
chdir($basedir);
$filelist = system('ls -lR');
print ("file list: $filelist");
?>
add it to your cgi-bin directory, open a browser browse to the file and then, view page source on your browser.

YvetteKuhns
2-1-04, 05:34 PM
my boss says try this script

Who is your boss? Tell him Hello. :)

RocketJeff
2-1-04, 05:46 PM
Originally posted by serina
my boss says try this script:
Nice script, but the following might work a little cleaner for some people who only care about the disk space taken by the files in each directory. It uses the *nix 'du' (Disk Usage) command.<?php
$basedir = '/www/u/username/';
chdir($basedir);
print "<pre>";
print system('du -h');
print "</pre>";
?>