From 906f9a139db5bea8371fefe525f7ea51996b10fc Mon Sep 17 00:00:00 2001 From: Ivor Townsend Date: Tue, 17 May 2022 08:53:06 +0100 Subject: [PATCH 1/2] feat: Adding copymax parameter --- base/mp_copyfolder.sas | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/base/mp_copyfolder.sas b/base/mp_copyfolder.sas index 837882b..b53fd37 100644 --- a/base/mp_copyfolder.sas +++ b/base/mp_copyfolder.sas @@ -18,6 +18,9 @@ @param source Unquoted path to the folder to copy from. @param 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.

SAS Macros

@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=©max) /* create folders and copy content */ data _null_; From 6669e74baafe51135662bbae26c24258e3fe3546 Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Tue, 17 May 2022 08:55:02 +0000 Subject: [PATCH 2/2] chore: running all.sas and updating docs --- all.sas | 14 +++++++++----- base/mp_copyfolder.sas | 6 +++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/all.sas b/all.sas index 4b2005b..46ad7f6 100644 --- a/all.sas +++ b/all.sas @@ -3875,8 +3875,11 @@ drop table &ddlds,&cntlds; %mp_copyfolder(&rootdir,©dir) - @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.

SAS Macros

@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=©max) /* 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 diff --git a/base/mp_copyfolder.sas b/base/mp_copyfolder.sas index b53fd37..0199683 100644 --- a/base/mp_copyfolder.sas +++ b/base/mp_copyfolder.sas @@ -16,8 +16,8 @@ %mp_copyfolder(&rootdir,©dir) - @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. @@ -81,4 +81,4 @@ proc sql; drop table work.&tempds; -%mend mp_copyfolder; \ No newline at end of file +%mend mp_copyfolder;