29 %LOCAL dirfile encoding s l_i_path;
32 create table &o_out (filename
char(255));
35 %IF (not %sysfunc (exist (&o_out))) %THEN %GOTO errexit;
37 %let encoding=pcoem850;
39 %let dirfile=%sysfunc(pathname(work))/&o_out..dir.txt;
40 filename _dirfile
"&dirfile" encoding=&encoding;
44 %let l_i_path=%qsysfunc(tranwrd(&i_path, %str( ), %str(\ )));
46 %let search = %qscan(&l_i_path.,-1,
'/');
47 %let k = %index(&l_i_path.,%qtrim(&search.));
48 %let path = %qsubstr(&l_i_path.,1,%eval(&k.-2));
49 %
if %qsubstr(&path.,1,1) eq %str(%') %then
50 %let path = &path.%str(%');
51 %if %qsubstr(&path.,1,1) eq %str(%") %then
52 %let path = &path.%str(%");
54 %SYSEXEC(find -L &path. ! -name &path -name "&search." -ls -type f > &dirfile.);
56 %if &g_verbose. %then %do;
57 %put ======== OS Command Start ========;
59 %if &sysrc. = 0 %then %put &g_note.(SASUNIT): Sysrc : 0 -> SYSEXEC SUCCESSFUL;
60 %else %put &g_error.(SASUNIT): Sysrc : &sysrc -> An Error occured;
63 %put &g_note.(SASUNIT): SYSEXEC COMMAND IS: find -L &path. ! -name &path -name "&search." -ls -type f > &dirfile.;
67 infile "&dirfile" truncover lrecl=512;
71 %put ======== OS Command End ========;
74 data &o_out (keep=membername filename changed );
77 length filename membername $255
78 temp_path temp_file $255
81 format changed datetime20.;
82 infile _dirfile delimiter=
' ' truncover;
83 input dum1-dum7 $ dat1-dat3 $ fileall $;
85 if substr(dum3,1,1)=
'd' then
delete;
86 if index(dat3,
':') gt 0 then do;
87 changed = input(compress(dat2 || dat1 || year(today())) || " " || dat3, datetime.);
88 if datepart(changed) gt today() then do;
89 changed = input(compress(dat2 || dat1 || year(today())-1) || " " || dat3, datetime.);
93 changed =input(compress( dat2 || dat1 || dat3) || " 00:00", datetime.);
95 loca = length(filename) - length(scan(filename,-1,'/')) + 1;
96 membername = substr(filename,loca);
98 %if &i_recursive=0 %then %do;
99 temp_path = dequote("&path");
100 temp_file = scan(filename,-1,"/");
101 if (trim(temp_path) !! "/" !! trim(temp_file) = filename) then output;