BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
spjcdc
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
FriedEgg
SAS Employee

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

3 REPLIES 3
FriedEgg
SAS Employee

options noxwait;

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

spjcdc
Calcite | Level 5

Thanks very much.  I hoped it would be simple.

Steve

Ksharp
Super User

Introducing a new function FCOPY() in SAS9.4

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

Xia Keshan

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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