Esempio n. 1
0
 def listfiles(self,path):
     files = []
     for i in os.listdir(path):
         f = os.path.join(path,i)
         finfo = os.stat(f)
         file = FileStruct()
         file.name = i
         file.path = f
         file.mtime = finfo.st_mtime  
         file.isfile = 0
         file.parent = path
         if os.path.isfile(f):
             file.isfile = 1
         files.append(file)
     return files
Esempio n. 2
0
 def travel(self, path):
     files = []
     for root, dirs, filelist in os.walk(path):
         for dir in dirs:
             f = os.path.join(root,dir)
             finfo = os.stat(f)
             file = FileStruct()
             file.name = dir
             file.path = f
             file.mtime = finfo.st_mtime  
             file.isfile = 0
             file.parent = root  
             files.append(file)              
         for fn in filelist:
             f = os.path.join(root,fn)
             finfo = os.stat(f)
             file = FileStruct()
             file.name = fn
             file.path = f
             file.mtime = finfo.st_mtime  
             file.isfile = 1
             file.parent = root  
             files.append(file) 
     return files