def check_dirs(basedir, **kwargs): """ Check all directories in directory """ flag = False for d in util.walk_uuids(basedir): result = check_dir(d, **kwargs) if result is not None: flag = True print d, result return not flag
def main(root_dirs): if os.path.exists(constant.TOTAL): print 'File already exists. Must delete manually' return root_dirs.sort() with open(constant.TOTAL, 'w') as f: for root_dir in root_dirs: print 'Starting {}'.format(root_dir) for i, uuid_dir in enumerate(util.walk_uuids(root_dir)): if not (i % 1000): print uuid_dir f.write(uuid_dir + '\n')
def move_builds(source_base, target_base): """ Move all the build directories from source to target, recursive """ if source_base.endswith('/'): source_base = source_base[:-1] if target_base.endswith('/'): target_base = target_base[:-1] if not source_base: raise ValueError('cannot have empty or root source_base') if source_base == target_base: raise ValueError('source_base and target_base are identical') #for x in (source_base, target_base): # if not util.is_octet_dir(x): # raise ValueError('{} is not an octet directory'.format(x)) for source in util.walk_uuids(source_base): # remove source_base source = os.path.join(source, 'buildResults') target = target_base + source[len(source_base):] if os.path.isdir(source): print 'moving {} to {}'.format(source, target) shutil.move(source, target)
def remove_all_empty_dirs(basedir): for d in util.walk_uuids(basedir): remove_empty_dirs(d)
def remove_filesizes_recursive(source_base): """ Remove all file_sizes.txt files """ for dirpath in util.walk_uuids(source_base): remove_filesizes(dirpath)