(Space is provided on the following page for your answer.)
The overall purpose of the program is to perform disk space analysis
on the contents of a directory - e.g. the user could call it on their
home directory to get an analysis of where their disk space is being
used.
The user provides, as command line arguments, the name of the directory to be analyzed and a value between 0 and 100 representing a usage threshold, e.g. 25 would mean 25%. The program explores the directory and its subdirectory tree, displays the total space used by the directory, and then for each file and each subdirectory that uses more than the specified percent of the total space in the directory the program will display:
and suppose the total space taken up by the user's directory was 150m. Then the program would display the path/name, size, and % of every file or subdirectory in the user's account that was at least 30m (20% of 150). E.g. ~ total space: 150m 43.0% (64.5m): ~/.mozilla/ 40.0% (60.0m): ~/.mozilla/cache/ 35.0% (52.5m): ~/.mozilla/cache/oops.txt Of course, the program should provide suitable error messages (and NOT crash) if it is provided with invalid command line arguments, and when it encounters files or directories it does not have permission to access. |