Next / Previous / Contents / Shipman's homepage

5. softlinks.py: Find soft links in a directory tree

The softlinks.py script will find all the Unix-style soft links in a given list of directory trees. For each soft link, it shows the target path to which the link points, and it will also flag broken links, that is, soft links whose target is a path that does not exist.

The command line arguments are the path names of the directory trees you want to search. If you provide no arguments, the search begins in the current working directory “.”.

softlinks.py [dir ...]

Each soft link results in two lines of output. Here is the general form, when the soft link points to an existing file:

linkPath ->
        targetPath

where linkPath is the path to the soft link, and the targetPath is the absolute path name where the link points.

If the link is broken, a string of pound signs is added so that broken links stand out:

linkPath ->
   #### targetPath