Exemple #1
0
 def getFile(self, path, fileAttrs=[], includeAll=0):
     '''Retrieves file by specified path
     str -> File
     @raises PathNotFoundException if specified path is not valid
     @raises FsException if error occurs while retrieving file
     '''
     path = self.__normalizePath(path)
     batchFileRetriever = WindowsFileInfoDiscovererByBatch(self._shell, fileAttrs)
     if (batchFileRetriever.exists(path, includeAll)):
         return batchFileRetriever.getFile(path)
     raise PathNotFoundException(path)
Exemple #2
0
    def getFiles(self, path, recursive=0, filters=[], fileAttrs=[]):
        '''Retrieves list of files in specified path.
        str, bool, list(FileFilter) -> list(File)
        @raises PathNotFoundException if specified path is not valid
        @raises FsException if error occurs while retrieving files
        '''

        batchFileRetriever = WindowsFileInfoDiscovererByBatch(self._shell, fileAttrs)
        path = self.__normalizePath(path)
        if (batchFileRetriever.exists(path)):
            files = batchFileRetriever.getFiles(path, recursive)
            return self.filter(files,  filters)
        raise PathNotFoundException(path)