Reputation: 4006
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");
Upvotes: 2
Views: 1569
Reputation: 9569
Double up your quotes!
x "copy ""\\aaa\b c d\eee.pdf"" \\fff\ggg.pdf";
Upvotes: 2
Reputation: 51581
Use the QUOTE()
function. It will properly double the internal quotes in the string that you are trying to quote.
x %sysfunc(quote(copy "\\aaa\b c d\eee.pdf" "\\fff\ggg.pdf"));
Upvotes: 1
Reputation: 1438
Replace x
with %sysexec
and you won't need the quotes.
%sysexec copy "\\aaa\b c d\eee.pdf" "\\fff\ggg.pdf";
Upvotes: 3