Replacement OR extra credit assignment

Write a short program to recursively test a directory for its adherence to Benford's Law with respect to the size of files found in Linux directories.

Please write this in Python, Perl, or C. Please make sure that your script doesn't cross any mount points.

Your program should take one argument, the starting directory for the program. It should recursively walk all subdirectories that are on the same device as the original directory, and the count the number of items that have a file size that starts with each digit from '1' to '9'. Benford's law suggest that the distribution will be heavily weighted toward file sizes that begin with a '1', then '2', and with relatively few instances of '8' or '9'.

For instance, you should be able to run your program in this manner and get similar results (or not! maybe you can find a non-trivial exception to Benford's law. ;-)

% ./benford-check /usr
Device number is 2048
Starts with
  1 --> 54431 times (40.12)
  2 --> 20237 times (14.92)
  3 --> 14875 times (10.96)
  4 --> 9598 times ( 7.07)
  5 --> 8918 times ( 6.57)
  6 --> 7772 times ( 5.73)
  7 --> 7354 times ( 5.42)
  8 --> 6370 times ( 4.69)
  9 --> 5983 times ( 4.41)

Please send me a tar file with your code (and a Makefile if you need one) and one text file called "results.txt" that has both reports for /usr and /usr/local/ on linprog8.

This is a pass/fail assignment; you either will get full credit or you will get no credit.

Please send your answers to me via email by 11:59pm on Friday, April 27th; I will give this either a make-up assignment, or for extra credit in the class, based on whichever helps your grade the more.