Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. import os
  2. def getfilez(dir):
  3.  
  4.     for name in os.listdir(dir):
  5.         path = os.path.join(dir,name)
  6.  
  7.         if os.path.isfile(path):
  8.             j = os.path.splitext(path)
  9.            
  10.             if j[1]=='.txt':
  11.                 print path
  12.         else:
  13.             getfilez(path)
  14. m = "C:\Users\6CDG83DFV443RP443RP4\Documents\infodocs"
  15. getfilez(m)
  16.  
  17.  
  18. raceback (most recent call last):
  19.   File "C:/Python27/filezz.py", line 15, in <module>
  20.     getfilez(m)
  21.   File "C:/Python27/filezz.py", line 4, in getfilez
  22.     for name in os.listdir(dir):
  23. WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\x06CDG83DFV443RP443RP4\\Documents\\infodocs/*.*'
  24. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement