initial import
darcs-hash:20000523101252-92525-e00949e2b4ca204828ff25f835cb80acd5d77ff5.gz
This commit is contained in:
parent
bcd157422d
commit
c6560d39b7
1 changed files with 29 additions and 0 deletions
29
unref.py
Executable file
29
unref.py
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#! /usr/bin/python
|
||||||
|
# recursively print links, Sam K (2000)
|
||||||
|
import os,string,getopt,sys
|
||||||
|
|
||||||
|
def simplif(base,n) :
|
||||||
|
return os.path.normpath(os.path.join(base,n))
|
||||||
|
|
||||||
|
optlist, args = getopt.getopt(sys.argv[1:], "")
|
||||||
|
n=args[0]
|
||||||
|
print n
|
||||||
|
cur=os.path.abspath(".")
|
||||||
|
i=0
|
||||||
|
while i<2000 and os.path.islink(os.path.join(cur,n)) :
|
||||||
|
print "%d-level link : %s -> %s" % (i,n,os.readlink(n))
|
||||||
|
n2=simplif(os.path.dirname(n),os.readlink(n))
|
||||||
|
# print " - > %s" % n2
|
||||||
|
i=i+1
|
||||||
|
n=n2
|
||||||
|
if i>=2000 :
|
||||||
|
print "Circular links : %s / %s " % (cur,args[0])
|
||||||
|
raise "circular_link"
|
||||||
|
|
||||||
|
print "real File : %s" % n
|
||||||
|
if os.path.isfile(n) :
|
||||||
|
os.system('ls -lF '+n)
|
||||||
|
os.system("file "+n)
|
||||||
|
else :
|
||||||
|
print "Broken Link !!"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue