Next / Previous / Contents / Shipman's homepage

9. Source code for softlinks.py

The overall flow of this script is similar to that for bigfiles.py. If any directory paths are given on the command line, a report is printed for each one. If there are no command line arguments, one report is printed for the current directory “.”.

As the os.path.walk() function visits every directory and file in a tree, the visitor function finds the soft links, and accumulates a list of PathInfo instances for each one. Those instances are sorted by path name (which is the default ordering for PathInfo instances), then the entries in the sorted list are displayed in the body of the report.