File size distribution

From Rosetta Code
Revision as of 15:25, 7 September 2016 by rosettacode>Legrady (Created page with "{{task}}File Size Distribution Beginning from the current directory, or optionally from a directory specified as a command-line argument, determine how many files there are o...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Task
File size distribution
You are encouraged to solve this task according to the task description, using any language you may know.

File Size Distribution

Beginning from the current directory, or optionally from a directory specified as a command-line argument, determine how many files there are of various sizes in a directory hierarchy. My suggestion is to sort by logarithmn of file size, since a few bytes here or there, or even a factor of two or three, may not be that significant. Don't forget that empty files may exist, to serve as a marker. Is your file system predominantly devoted to a large number of smaller files, or a smaller number of huge files?