DATA Step, Macro, Functions and more

Copy .sas Files with UNC path names

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

Copy .sas Files with UNC path names

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


Accepted Solutions
Solution
‎01-20-2015 11:41 AM
Trusted Advisor
Posts: 1,300

Re: Copy .sas Files with UNC path names

options noxwait;

and try using xcopy instead of copy with the UNC path.  Mounting the network to a drive would work too.

View solution in original post


All Replies
Solution
‎01-20-2015 11:41 AM
Trusted Advisor
Posts: 1,300

Re: Copy .sas Files with UNC path names

options noxwait;

and try using xcopy instead of copy with the UNC path.  Mounting the network to a drive would work too.

Contributor
Posts: 27

Re: Copy .sas Files with UNC path names

Thanks very much.  I hoped it would be simple.

Steve

Super User
Posts: 9,691

Re: Copy .sas Files with UNC path names

Introducing a new function FCOPY() in SAS9.4

http://blogs.sas.com/content/sasdummy/2013/09/17/copy-file-macro/

Xia Keshan

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 492 views
  • 0 likes
  • 3 in conversation