Walk A Path
Join the DZone community and get the full member experience.
Join For Free
#!/usr/bin/env python
import os
from os.path import isdir, abspath, join
from glob import iglob
def walk(name='.'):
print abspath(name)
for item in iglob(join(name, '*')):
if isdir(item):
walk(item)
else:
print abspath(item)
if __name__ == '__main__':
walk()
Opinions expressed by DZone contributors are their own.
Comments