1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| %macro modif(rep=,type=,date=);
PROC FORMAT;
VALUE $mois
'janvier'=01
'fevrier'=02
'mars'=03
'avril'=04
'mai'=05
'juin'=06
'juillet'=07
'août'=08
'septembre'=09
'octobre'=10
'novembre'=11
'decembre'=12;
run;
DATA test (keep=name date_mod cr_date Bytes);
rc=filename ("rep","&rep");
dirid = DOPEN("rep") ;
DO i=1 TO DNUM(dirId) ;
rc = FILENAME("fic", TRIM("&rep.\")!!LEFT(DREAD(dirid,i))) ;
name=dread(dirid,i);
if index( name, "&type.") then do ;
fid = FOPEN("fic") ;
date=finfo(fid,'Last Modified');
LastModJ=input(SCAN(Date ,1," "),best.);
mois=SCAN(Date ,2," ");
LastModM=input( put(mois,mois.),best.);
LastModA=input(SCAN(Date ,3," "),best.) ;
date =mdy(LastModM,LastModJ,LastModA);
datelast=input(compress(date),best.);
date_mod=put(datelast,date9.);
if datelast>="&date."d then do;
Bytes=finfo(fid,'File Size (bytes)');
cr_date=finfo(fid,'Create Time');
output;
end;
fid = fclose( fid ) ;
END ;
END;
rc = DCLOSE(dirId) ;
RUN ;
filename rep clear;
%mend;
*/Exemple/*
%modif(rep=C:\temp,type=txt,date=01aug2015); |