def all_uploads(): response = '<ul>' uploads = DirPaths('/app/uploads', full_paths=False).walk() for upload in uploads: response += ''' <li> <a href="/uploads/{0}">{0}</a> </li> '''.format(upload) response += '</ul>' return response
def parse_directory(self): """ Scan the directory for file's eligible to-be nested. Only accept files that contain the 'separator' character and match file_type filters. """ return [ fp for fp in DirPaths( self._root, True, to_include=self._file_types, max_level=1).walk() if self.separator in fp ]
def test_sync(self): target = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'awsutils') self.s3.sync(target, quiet=True) self.assertEqual( set(self.s3.list(recursive=True)), set([ os.path.join('awsutils', path).replace('\\', '/') for path in DirPaths( os.path.join(LOCAL_BASE, 'awsutils')).walk() ]))
def all_uploads(): uploads = DirPaths(UPLOAD_FOLDER, full_paths=False).walk() if len(uploads) > 0: response = '<ul>' for upload in uploads: response += ''' <li> <a href="/uploads/{0}">{0}</a> </li> '''.format(upload) response += '</ul>' return response else: return 'No files exist in directory {0}'.format(UPLOAD_FOLDER)
def all_uploads(): uploads = DirPaths('/efs', full_paths=True).walk() if len(uploads) > 0: response = '<ul>' for upload in uploads: response += ''' <li> <a href="{0}">{0}</a> </li> '''.format(upload) response += '</ul>' return response else: return 'No files exist in directory {0}'.format('/efs')
def compare_trees(dir1, dir2): """Parse two directories and return lists of unique files""" paths1 = DirPaths(dir1).walk() paths2 = DirPaths(dir2).walk() return unique_venn(paths1, paths2)
def get_paths(): return DirPaths(DIRECTORY, full_paths=True, parallelize=False).walk()
}, 2: { 'include': { 'Con Docs', 'Design Development', 'Marketing', 'Photos', 'Plot Files' } } } with Timer(DirPaths): for i in range(0, iters): paths = DirPaths(root, console_output=True, parallelize=True, to_exclude=to_exclude, max_level=max_level, filters=filters, console_stream=False, pool_size=16, non_empty_folders=True).walk() paths_sorted = sorted(paths) with Timer(DirPaths): for i in range(0, iters): paths2 = DirPaths(root, console_output=True, console_stream=False, to_exclude=to_exclude, max_level=max_level, filters=filters, non_empty_folders=True).walk()