46 %
if &sysscp. = WIN %then %
do; 
 
   47    %local dirindicator_en dirindicator_de encoding;
 
   48    %let dirindicator_en=Directory of;
 
   49    %let dirindicator_de=Verzeichnis von;
 
   50    %let encoding=pcoem850;
 
   51    %let i_path = %sysfunc(translate(&i_path,\,/));
 
   54       create table &o_out (filename 
char(255));
 
   56    %IF &syserr NE 0 %THEN %GOTO errexit;
 
   58    %local xwait xsync xmin;
 
   59    %let xwait=%sysfunc(getoption(xwait));
 
   60    %let xsync=%sysfunc(getoption(xsync));
 
   61    %let xmin =%sysfunc(getoption(xmin));
 
   63    options noxwait xsync xmin;
 
   66    %let dirfile=%sysfunc(pathname(work))\___dir.txt;
 
   67    filename _dirfile 
"&dirfile" encoding=&encoding;
 
   69    %IF &i_recursive %then %let s=/S;
 
   70    %put SYSEXEC(dir &s 
"&i_path" > 
"&dirfile");
 
   71    %SYSEXEC(dir &s /a-d 
"&i_path" > 
"&dirfile");
 
   73    options &xwait &xsync &xmin;
 
   75    data &o_out (keep=filename changed);
 
   76       length dir filename $255 language $2;
 
   77       retain language 
"__" dir FilePos;
 
   78       infile _dirfile truncover;
 
   79       input line $char255. @;
 
   80       if index (line, 
"&dirindicator_en") or index (line, "&dirindicator_de") then do;
 
   81          if index (line, "&dirindicator_en") then do;
 
   82             dir = substr(line, index (line, "&dirindicator_en")+length("&dirindicator_en")+1);
 
   85             dir = substr(line, index (line, "&dirindicator_de")+length("&dirindicator_de")+1);
 
   88       if substr(line,1,1) ne ' ' then do;
 
   89          * Check for presence of AM/PM in time value, because you can specify AM/PM timeformat in German Windows *;
 
   90          if (language = "__") then do;
 
   91             Detect_AM_PM = upcase (scan (line, 3, " "));
 
   92             if (Detect_AM_PM in ("AM", "PM")) then do;
 
   93                Filenamepart = scan (line,5, " ");
 
   94                Filepos      = index (line, trim(Filenamepart));
 
   98                Filenamepart = scan (line,4, " ");
 
   99                Filepos      = index (line, trim(Filenamepart));
 
  103          if language='DE' then do;
 
  115          changed  = dhms (d, hour(t), minute(t), 0);
 
  116          format changed datetime20.;
 
  117          filename = translate(trim(dir) !! '/' !! substr (line,FilePos),'/','\');
 
  125 %else %if &sysscp. = LINUX %then %do;
 
  127    %LOCAL dirfile encoding s;
 
  130        length filename $255;
 
  131        format changed datetime20.;
 
  134    %IF &syserr NE 0 %THEN %GOTO errexit;
 
  136    %LET encoding=wlatin1;
 
  137    %LET dirfile=%sysfunc(pathname(work))/.dir.txt;
 
  138    filename _dirfile "&dirfile" encoding=&encoding;
 
  140    %put Directory search is: &i_path;
 
  141    %IF &i_recursive=0 %then %let s=-maxdepth 1;
 
  142    %SYSEXEC(find -P &i_path. &s. -type f -printf "%nrstr(%h/%f\t%TD\t%TT\t\r\n)" > &dirfile. 2>/dev/null);
 
  144    data &o_out (keep=filename changed);
 
  145        length filename $255;
 
  146        format changed datetime20.;
 
  147        infile _dirfile delimiter='09'x truncover;
 
  148        input filename $ d:mmddyy8. t:time8.; 
 
  149        changed = dhms (d, hour(t), minute(t), 0);