Code:def process_dir(arg, dirname, names):
for name in names:
name_path = "%s/%s" % (dirname, name)
if os.path.islink(name_path):
os.path.walk(name_path, process_dir, arg)
print "[%s] Found at %s: %s" % (arg, dirname, ", ".join(names))
os.path.walk("/home/sven/sample", process_dir, "Test")
Output:[Test] Found at /home/sven/sample/testdir3: testfile5.txt
[Test] Found at /home/sven/sample: testfile1.txt, testdir3, testdir1, testdir2
[Test] Found at /home/sven/sample/testdir1: testfile4.txt, testfile3.txt, testdir1a
[Test] Found at /home/sven/sample/testdir1/testdir1a: testfile2.txt
[Test] Found at /home/sven/sample/testdir2: testfile5.txt