home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 April / PCWorld_2001-04_cd.bin / Software / TemaCD / webclean / !!!python!!! / BeOpen-Python-2.0.exe / LLL.PY < prev    next >
Encoding:
Python Source  |  2000-09-28  |  627 b   |  26 lines

  1. #! /usr/bin/env python
  2.  
  3. # Find symbolic links and show where they point to.
  4. # Arguments are directories to search; default is current directory.
  5. # No recursion.
  6. # (This is a totally different program from "findsymlinks.py"!)
  7.  
  8. import sys, os
  9.  
  10. def lll(dirname):
  11.     for name in os.listdir(dirname):
  12.         if name not in (os.curdir, os.pardir):
  13.             full = os.path.join(dirname, name)
  14.             if os.path.islink(full):
  15.                 print name, '->', os.readlink(full)
  16.  
  17. args = sys.argv[1:]
  18. if not args: args = [os.curdir]
  19. first = 1
  20. for arg in args:
  21.     if len(args) > 1:
  22.         if not first: print
  23.         first = 0
  24.         print arg + ':'
  25.     lll(arg)
  26.