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_parentsfrom util import 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 retif __name__ == "__main__": td = datetime.datetime.today() ret = build(datetime.datetime(td.year,(td.month - 1 -1)%12+1,1),r'X:\Users\Ralphie')
|