#!/usr/bin/env python3.2
import os
import sys
fileList = []
rootdir = sys.argv[1]
for subdir, dirs, files in os.walk(rootdir, followlinks=True):
for file in files:
f = os.path.join(subdir,file)
if os.path.islink(file):
countlink = countlink+1
linkto = os.readlink(f)
print(linkto)
If i give this code a folder say /Current and files /Current/file.exe and a symlink /Current/link, the "islink" doesnt recognize the "link" symlink but considers it a directory and moves on to the actual file it links to. My requirement is to just stop when it finds a symlink and print it. i am using Python3.2