%macro file_lister ( pfad = , file = , outlib = work , outtab = file_list ); %if %bquote(&file) = %str(*) %then %do; %if &sysscp. = WIN %then %do; filename trf pipe "dir /s ""&pfad."""; %end; %else %do; filename trf pipe "ll -t &pfad."; %end; %end; %else %do; %if &sysscp. = WIN %then %do; filename trf pipe "cd ""&pfad."" & dir /s &file."; %end; %else %do; filename trf pipe "cd &pfad.; ll -t &file."; %end; %end; /* Note: The structure returned by "dir" / "ll" depends on language settings */ data &outlib..&outtab.; %if &sysscp. = WIN %then %do; /* Read windows structure ... tested with language setting: german*/ infile trf missover; input; length dir $ 200; retain dir; if _infile_ =: " Verzeichnis von" then do; dir = substr (_infile_, 18); return; end; format win_date date9.; win_date = input (scan (_infile_, 1, ' '), ?? ddmmyy10.); if win_date = . then return; format uhrzeit time5.; if (scan (_infile_, 3, ' ') = 'p.m.' or scan (_infile_, 3, ' ') = 'a.m.') then do; uhrzeit = input (scan (_infile_, 2, ' '), time5.) + (scan (_infile_, 3, ' ') = 'p.m.') * 3600 * 12; size = input (compress (scan (_infile_, 4, ' '), ','), best.); file = scan (_infile_, 5, ' '); end; else do; uhrzeit = input (scan (_infile_, 2, ' '), time5.); size = input (compress (scan (_infile_, 3, ' '), ','), commax12.); file = scan (_infile_, 4, ' '); end; output; %end; %else %do; /* Read unix structure ... did not test this ;-) */ attrib ll1 ll2 ll3 ll4 ll5 ll6 ll7 ll8 File length=$128; attrib size kumsize length=8 format=commax20. unix_date length=8 format=ddmmyy10. uhrzeit format=time6.0 tag monat jahr length=8 ; infile trf missover; input ll1 -- ll8 file; if ll1 ne 'insgesamt'; /* erste Zeile ueberlesen falls mehrere Dateien */ if substr(ll1, 1, 1) ne 'd'; /* keine Verzeichnisse */ %end; run; %mend file_lister;