SASUnit Examples  Version 1.5.0
linux/_copydir.sas
Go to the documentation of this file.
1 
24 %macro _copyDir (i_from
25  ,i_to
26  );
27 
28  %LOCAL l_i_from l_i_to logfile;
29 
30  %let l_i_from = %qsysfunc(tranwrd(&i_from, %str( ), %str(\ )));
31  %let l_i_to = %qsysfunc(tranwrd(&i_to, %str( ), %str(\ )));
32  %let logfile = %sysfunc(pathname(work))/___log.txt;
33 
34  %SYSEXEC(cp -R &l_i_from. &l_i_to. > "&logfile" 2>&1);
35  %if &g_verbose. %then %do;
36  %put ======== OS Command Start ========;
37  /* Evaluate sysexec´s return code*/
38  %if &sysrc. = 0 %then %put &g_note.(SASUNIT): Sysrc : 0 -> SYSEXEC SUCCESSFUL;
39  %else %put &g_error.(SASUNIT): Sysrc : &sysrc -> An Error occured;
40 
41  /* put sysexec command to log*/
42  %put &g_note.(SASUNIT): SYSEXEC COMMAND IS: cp -R &l_i_from. &l_i_to. > "&logfile" 2>&1;
43 
44  /* write &logfile to the log*/
45  data _null_;
46  infile "&logfile" truncover lrecl=512;
47  input line $512.;
48  putlog line;
49  run;
50  %put ======== OS Command End ========;
51  %end;
52 %mend _copyDir;