I want list all directories and files in python.
here is short code:
#!/usr/bin/python
import os
COUNT=0
for root, dirs, files in os.walk('/home/kraneis/python/'):
for name in files:
filename = os.path.join(root,name)
print filename
COUNT +=1
TOTAL=COUNT
print "Es gibt insgesamt " + str(TOTAL) + " files"
….
….
/home/kraneis/python/examples/xml/languages.xml
/home/kraneis/python/examples/numbers/decimal_localcontext.py
/home/kraneis/python/examples/numbers/get_sample_naive.py
/home/kraneis/python/examples/lists/allindex.py
/home/kraneis/python/examples/lists/listsortci.py
Es gibt insgesamt 3448 files