Search code examples
sassas-macro

SAS : how copy a folder containing subfolders


I want copy a folder containing subfolders in SAS:

Example of the folder that I want copy :

folder_to_copy/
├─ sub_folder_1/
├─ sub_folder_2/
│  ├─ file_sub1
│  ├─ file_sub2
│  ├─ file_sub3
├─ file1/
├─ file2/

I've try

option xwait xsync;
X copy "folder_to_copy"  "new_folder";

But this copy only file1 and file2

and

data _null_;
call system ('cp  folder_to_copy new_folder');
run;

doesn't work too, this does nothing


Solution

  • Use cp -R if you're using Linux.

    x 'cp -R folder_to_copy new_folder';
    

    Use robocopy /E if you're using Windows.

    x 'robocopy folder_to_copy new_folder /E';