You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
import osimport os.path as ospimport datetimefrom util import no_parents,get_drivesdef build(after,*starts): if isinstance(after,datetime.datetime): after = after.timestamp() var_unsubbed = map(osp.expandvars,starts) abs_paths = map(osp.abspath,var_unsubbed) starts = list(no_parents(abs_paths)) ret = [] for path in starts: for root,dirs,files in os.walk(path,topdown=True): try: dirs[:] = list(filter( lambda p: osp.getmtime(osp.join(root,p)) > after, dirs )) ret += [osp.join(root,file) for file in files] except: print('Error',root,sep= ': ') return ret def build_ext(ext,paths): ret = {} for path in paths: if path.endswith(ext): name = osp.basename(path) try: ret[name].append(path) except KeyError: ret[name] = [path] return ret
|