I've got several .sas files that I want to copy from one directory on the server to another. I've got code like below that works fine, but each time it opens up the command window and I have to type 'quit' in each window to get it to go to the next one.
%let fromdir = Dev ;
%let todir = Test ;
%sysexec copy "\\my_server\&FromDir\Program 1.sas" "\\my_server\&ToDir\Program 1.sas" /y ;
%sysexec copy "\\my_server\&FromDir\Program 2.sas" " \\My_server\&ToDir\Program 2.sas " /y ;
I'd be happy to create a .bat file to do this but I'm not convinced that I could get it to work. When I type the command at the command prompt it says that it cannot find the file specified. I've tried this with quotes and without quotes and with files without spaces in their names. I guess I could map a drive letter to the path that I need and get the copy command to work in a .bat file, but if there's another way to do it using SAS so that the command window doesn't open up and have to be closed each time, I'd appreciate your telling me.
Thanks,
Steve
Steve James
Centers for Disease Control and Prevention
options noxwait;
and try using xcopy instead of copy with the UNC path. Mounting the network to a drive would work too.
options noxwait;
and try using xcopy instead of copy with the UNC path. Mounting the network to a drive would work too.
Thanks very much. I hoped it would be simple.
Steve
Introducing a new function FCOPY() in SAS9.4
http://blogs.sas.com/content/sasdummy/2013/09/17/copy-file-macro/
Xia Keshan
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.