lcast15

Directory File Scanner (Including Sub DIRs)

Feb 4th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. def Scanner(DIR):
  2.     ReturnList = []
  3.     for i in os.scandir(DIR):
  4.         if i.is_file():
  5.             ReturnList.append(i.name)
  6.         elif i.is_dir():
  7.             for x in Scanner(DIR + '/' + i.name):
  8.                 ReturnList.append(i.name + '/' + x)
  9.                
  10.     return ReturnList
Advertisement
Add Comment
Please, Sign In to add comment