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 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'.

In order to test your program, you can use's /usr directory, which should give you results similar to these:

% ./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 one flat text file called "results.txt" that has a reports for /usr and /usr/local/ on

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, May 5; please indicated if you wish to count this as a make-up assignment or for extra credit in the class.