37%macro mp_copyfolder(source,target,copymax=MAX);
39 %mp_abort(iftrue=(%mf_isdir(&source)=0)
41 ,msg=%str(Source dir does not exist (&source))
46 %mp_abort(iftrue=(%mf_isdir(&target)=0)
48 ,msg=%str(Target dir could not be created (&target))
53 %let tempds=%mf_getuniquename();
56 %mp_dirlist(path=&source,outds=work.&tempds,maxdepth=©max)
63 if _n_ = 1 then dpos+sum(length(directory),2);
64 filepath2=
"&target/"!!substr(filepath,dpos);
65 if file_or_folder=
'folder' then call execute(
'%mf_mkdir('!!filepath2!!
')');
67 length fref1 fref2 $8;
68 rc1=filename(fref1,filepath,
'disk',
'recfm=n');
69 rc2=filename(fref2,filepath2,
'disk',
'recfm=n');
70 if fcopy(fref1,fref2) ne 0 then
do;
72 putlog
'ERR' +(-1)
"OR: Unable to copy " filepath
" to " filepath2;
82 drop table work.&tempds;