sascopy

How to use folders with spaces in SAS x "copy ..."?


In SAS I need to copy file from a place to another but that file is located in a folder with spaces which poses problems.

Here is what I want to do:

x "copy \\aaa\b c d\eee.pdf \\fff\ggg.pdf";

because of the spaces between b c and d it doesn't work.

I know I can do

x 'copy \\aaa\"b c d"\eee.pdf \\fff\ggg.pdf';

But the name of my files will use macro variables thus I need the double quotes around the copy statement.

Is there a way to escape doubles quotes in the copy statement? something like this for example (except % are not working)

x "copy \\aaa\%"b c d%"\eee.pdf \\fff\ggg.pdf";

EDIT
I also tried cats:

x cats("copy \\aaa\",'"b c d"',"\eee.pdf \\fff\ggg.pdf");

Solution

  • Replace x with %sysexec and you won't need the quotes.

    %sysexec copy "\\aaa\b c d\eee.pdf" "\\fff\ggg.pdf";