Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_copyfolder.sas File Reference

A macro to recursively copy a directory. More...

Go to the source code of this file.

Detailed Description

Performs a recursive directory listing then works from top to bottom copying files and creating subdirectories.

Usage:

%let rootdir=%sysfunc(pathname(work))/demo;
%let copydir=%sysfunc(pathname(work))/demo_copy;
%mf_mkdir(&rootdir)
%mf_mkdir(&rootdir/subdir)
%mf_mkdir(&rootdir/subdir/subsubdir)
data "&rootdir/subdir/example.sas7bdat";
run;

%mp_copyfolder(&rootdir,&copydir)
Parameters
[in]sourceUnquoted path to the folder to copy from.
[out]targetUnquoted path to the folder to copy to.
[in]copymax=(MAX) Set to a positive integer to indicate the level of subdirectory copy recursion - eg 3, to go ./3/levels/deep. For unlimited recursion, set to MAX.

SAS Macros

Related Macros

Definition in file mp_copyfolder.sas.