1
0
mirror of https://github.com/sasjs/core.git synced 2025-12-10 14:04:36 +00:00

Merge pull request #241 from sasjs/copyfolder_enhancement

feat: Adding copymax parameter
This commit is contained in:
Allan Bowe
2022-05-17 11:55:52 +03:00
committed by GitHub
2 changed files with 17 additions and 10 deletions

14
all.sas
View File

@@ -3875,8 +3875,11 @@ drop table &ddlds,&cntlds;
%mp_copyfolder(&rootdir,&copydir)
@param source Unquoted path to the folder to copy from.
@param target Unquoted path to the folder to copy to.
@param [in] source Unquoted path to the folder to copy from.
@param [out] target Unquoted path to the folder to copy to.
@param [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.
<h4> SAS Macros </h4>
@li mf_getuniquename.sas
@@ -3890,7 +3893,7 @@ drop table &ddlds,&cntlds;
**/
%macro mp_copyfolder(source,target);
%macro mp_copyfolder(source,target,copymax=MAX);
%mp_abort(iftrue=(%mf_isdir(&source)=0)
,mac=&sysmacroname
@@ -3909,7 +3912,7 @@ drop table &ddlds,&cntlds;
%let tempds=%mf_getuniquename();
/* recursive directory listing */
%mp_dirlist(path=&source,outds=work.&tempds, maxdepth=MAX)
%mp_dirlist(path=&source,outds=work.&tempds,maxdepth=&copymax)
/* create folders and copy content */
data _null_;
@@ -3937,7 +3940,8 @@ drop table &ddlds,&cntlds;
proc sql;
drop table work.&tempds;
%mend mp_copyfolder;/**
%mend mp_copyfolder;
/**
@file
@brief Create the permanent Core tables
@details Several macros in the [core](https://github.com/sasjs/core) library

View File

@@ -16,8 +16,11 @@
%mp_copyfolder(&rootdir,&copydir)
@param source Unquoted path to the folder to copy from.
@param target Unquoted path to the folder to copy to.
@param [in] source Unquoted path to the folder to copy from.
@param [out] target Unquoted path to the folder to copy to.
@param [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.
<h4> SAS Macros </h4>
@li mf_getuniquename.sas
@@ -31,7 +34,7 @@
**/
%macro mp_copyfolder(source,target);
%macro mp_copyfolder(source,target,copymax=MAX);
%mp_abort(iftrue=(%mf_isdir(&source)=0)
,mac=&sysmacroname
@@ -50,7 +53,7 @@
%let tempds=%mf_getuniquename();
/* recursive directory listing */
%mp_dirlist(path=&source,outds=work.&tempds, maxdepth=MAX)
%mp_dirlist(path=&source,outds=work.&tempds,maxdepth=&copymax)
/* create folders and copy content */
data _null_;
@@ -78,4 +81,4 @@
proc sql;
drop table work.&tempds;
%mend mp_copyfolder;
%mend mp_copyfolder;