PageRenderTime 13ms CodeModel.GetById 10ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Tools/scripts/lll.py

http://unladen-swallow.googlecode.com/
Python | 28 lines | 19 code | 4 blank | 5 comment | 14 complexity | b2a3f8cab727ec49ccc40c1556bc96f9 MD5 | raw file
 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
 8import sys, os
 9
10def 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)
16def main():
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
27if __name__ == '__main__':
28    main()