I have to copy 14K files from one directory to another. when using the below code, the cmd window opens 14K times and this is interrupting from doing further work.
1. How to make it work with out interrupting the user?
2. If the files are already presnt in destination folder, either delete them or overwrite them. The following code popups cmd window to manually key in the response by the user.
How to achieve above two conditions?
options noxwait noxsync;
data _null_;
%do i=1 %to &count.;
%sysExec xcopy "&landing_zone.\&&memname&i" "&dest.\";
%end;
run;
proc printto;
run;
You're passing a system command and need to find the relevant system option.
For XCOPY that appears to be /Y
See the Microsoft documentation, here:
Have you tried specifying the XMIN Option?
No ,havent tried
never tried that.
Looping lets me choose only the files of interest. I'm not sure how /s works.
if there are
abc.txt
pqr.txt
xyz.txt
and I want to choose only pqr.txt and xyz.txt based on some conditions, I will pass the two file names into a macro array and loop them to move to a new folder.
Imagine i had to move 14k files out of 50k
You're passing a system command and need to find the relevant system option.
For XCOPY that appears to be /Y
See the Microsoft documentation, here:
Like I mentioned you're using Windows command, SAS is just passing it to the system. Figure out what works in the system and that's a Windows question, not a SAS question.
Then incorporate that solution here.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.