in reply to help with FS usage script using a data struct
is suspect as well. $_ refers to the filename in the directory. This means that $_ isn't absolute, and hence the -d is done relative to the current directory. Unless the current directory is the same as where File::Find happens to be searching, it's not going to work.next unless -d $_;
Also be aware your approach is flawed. A stat() of a directory just gives you the size of the directory node in the file system. This has no relation to the total size of the files found in the directory. It's only related to the number of files (and perhaps the length of the filenames), or rather the maximum number of files the directory has had over its lifetime. (On some filesystems, directories may shrink in size, but on many filesystems, they do not).
You should be adding file (and directory) sizes. But you have to be careful. A 1 Mb file with 3 links should not be counted three times - the data is there only once.
Some OSses have commands that will report disk usage by UID on a filesystem. You might want to look into them.
Abigail
|
|---|