|
|
|
@ -1,9 +1,26 @@ |
|
|
|
import os |
|
|
|
from util import get_drives() |
|
|
|
import os.path as osp |
|
|
|
import datetime |
|
|
|
from util import no_parents |
|
|
|
from util import get_drives |
|
|
|
def build(after,*starts): |
|
|
|
if starts: |
|
|
|
paths = starts |
|
|
|
else: |
|
|
|
paths = get_drives() |
|
|
|
for path in paths: |
|
|
|
for root,dirs,files in os.walk( |
|
|
|
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 |
|
|
|
if __name__ == "__main__": |
|
|
|
td = datetime.datetime.today() |
|
|
|
ret = build(datetime.datetime(td.year,(td.month - 1 -1)%12+1,1),r'X:\Users\Ralphie') |