Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. import os
  4.  
  5. class FileManager():
  6.  
  7. def __init__(self, _masterPath):
  8. self.masterPath = _masterPath
  9.  
  10. self.loadFiles(self.masterPath)
  11.  
  12. #Récupération de tous les fichiers pour l'insertion
  13. def loadFiles(self, path):
  14. #Si c'est un FICHIER
  15. if os.path.isfile(path):
  16.  
  17. #Sinon, c'est un DOSSIER
  18. else:
  19. #Donc pour chaque élément dans ce dossier, récursivité sur la fonction
  20. for file in os.listdir(path):
  21. self.loadFiles(os.path.join(path, file))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement