<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Copy directories and sub directories dynamically in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353150#M82417</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename oscmd pipe "xcopy c:\source\* c:\target /s /y 2&amp;gt;&amp;amp;1";

data _null_;
infile oscmd;
input;
put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will copy all files in c:\source to c:\target, including all subdirectories. /y prevents prompting when a file already exists in the target.&lt;/P&gt;
&lt;P&gt;The filename pipe and data step are used to catch output from the command and write it to the SAS log; if you don't need that, you can issue the xcopy command in a X statement.&lt;/P&gt;
&lt;P&gt;I recommend doing the filename/data step method at least while testing.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Apr 2017 11:49:29 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-04-25T11:49:29Z</dc:date>
    <item>
      <title>Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353129#M82411</link>
      <description>&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;%let&lt;/SPAN&gt;&lt;SPAN&gt; source=c:\New folder;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;%let&lt;/SPAN&gt;&lt;SPAN&gt; target=c:\shubham;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&lt;SPAN&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; source ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;infile&lt;/SPAN&gt; &lt;SPAN&gt;"dir /b ""&amp;amp;source\"" "&lt;/SPAN&gt;&lt;SPAN&gt; pipe &lt;/SPAN&gt;&lt;SPAN&gt;truncover&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;input&lt;/SPAN&gt;&lt;SPAN&gt; fname &lt;/SPAN&gt;&lt;SPAN&gt;$256.&lt;/SPAN&gt;&lt;SPAN&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&lt;SPAN&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; target ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;infile&lt;/SPAN&gt; &lt;SPAN&gt;"dir /b ""&amp;amp;target\"" "&lt;/SPAN&gt;&lt;SPAN&gt; pipe &lt;/SPAN&gt;&lt;SPAN&gt;truncover&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;input&lt;/SPAN&gt;&lt;SPAN&gt; fname &lt;/SPAN&gt;&lt;SPAN&gt;$256.&lt;/SPAN&gt;&lt;SPAN&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&lt;SPAN&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; new;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;set&lt;/SPAN&gt;&lt;SPAN&gt; source ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;length&lt;/SPAN&gt;&lt;SPAN&gt; cmd1 &lt;/SPAN&gt;&lt;SPAN&gt;$100.&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp; cmd1 = catx(&lt;/SPAN&gt;&lt;SPAN&gt;' '&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'xcopy'&lt;/SPAN&gt;&lt;SPAN&gt;,quote(catx(&lt;/SPAN&gt;&lt;SPAN&gt;'\'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"&amp;amp;source"&lt;/SPAN&gt;&lt;SPAN&gt;,fname)),quote(&lt;/SPAN&gt;&lt;SPAN&gt;"&amp;amp;target"&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp; cmd= cat(&lt;/SPAN&gt;&lt;SPAN&gt;'X '&lt;/SPAN&gt;&lt;SPAN&gt;,cmd1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;infile&lt;/SPAN&gt;&lt;SPAN&gt; cmd&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;filevar&lt;/SPAN&gt;&lt;SPAN&gt;=cmd &lt;/SPAN&gt;&lt;SPAN&gt;end&lt;/SPAN&gt;&lt;SPAN&gt;=eof ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;do&lt;/SPAN&gt; &lt;SPAN&gt;while&lt;/SPAN&gt;&lt;SPAN&gt; (not eof);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;input&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;put&lt;/SPAN&gt; &lt;SPAN&gt;_infile_&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;end&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;Below is the error that comes up&amp;nbsp;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;ERROR: Invalid physical name.&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;fname=file1.txt cmd1=xcopy "c:\New folder\file1.txt" "c:\shubham"&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;cmd=X xcopy "c:\New folder\file1.txt" "c:\shubham" eof=0 _ERROR_=1 _INFILE_=&amp;nbsp; _N_=1&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: There were 1 observations read from the data set WORK.SOURCE.&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;WARNING: The data set WORK.NEW may be incomplete.&amp;nbsp; When this step was stopped there were 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; observations and 2 variables.&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;WARNING: Data set WORK.NEW was not replaced because this step was stopped.&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: DATA statement used (Total process time):&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;My goal is to copy all directories and subdirectories dynamically&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;how can I do that&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 09:21:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353129#M82411</guid>
      <dc:creator>Rohit12</dc:creator>
      <dc:date>2017-04-25T09:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353130#M82412</link>
      <description>&lt;P&gt;This line:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; infile cmd...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you can see from the error, CMD variable contains:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;X xcopy "c:\New folder\file1.txt" "c:\shubham"&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which is not valid SAS syntax. &amp;nbsp;Infile requires a path/filename, or fileref.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is it your copying, what is the process? &amp;nbsp;As I mentioned before, programs which create/copy folders/files should never really be needed. &amp;nbsp;You process should take care of that - i.e. follow an operating procedure, be inline with IT requirements, permissions etc. &amp;nbsp;Simply copying an pasting directories/files willy nilly will flag you up to IT.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 09:39:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353130#M82412</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-25T09:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353133#M82413</link>
      <description>&lt;P&gt;what I want is that I want to copy all the directories and subdirectories through sas&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for ex-I wan to copy from old&amp;nbsp;folder &amp;nbsp;which contain file1.txt and file2.txt &amp;nbsp;path- c:\old &amp;nbsp;folder &amp;nbsp;to a new path c:\new folder&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can I do this by SAS program&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 09:49:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353133#M82413</guid>
      <dc:creator>Rohit12</dc:creator>
      <dc:date>2017-04-25T09:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353135#M82414</link>
      <description>&lt;P&gt;I understand what you want, I don't understand&amp;nbsp;&lt;STRONG&gt;why&lt;/STRONG&gt; you want to do that. &amp;nbsp;Its never a good idea to multiple your file system, it sounds like there is some reasoning as to copying that, maybe thats a fixed copy and you don't want to alter it? &amp;nbsp;If so open it as read only and work with it in your work area - this is just an example. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 09:53:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353135#M82414</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-25T09:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353136#M82415</link>
      <description>&lt;P&gt;what i want is that whenver &amp;nbsp;I run SAS program it should copy file from one &amp;nbsp;directories to another&lt;/P&gt;&lt;P&gt;how caN i acheive that using SAS or any other &amp;nbsp;way&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please help me&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 10:02:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353136#M82415</guid>
      <dc:creator>Rohit12</dc:creator>
      <dc:date>2017-04-25T10:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353150#M82417</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename oscmd pipe "xcopy c:\source\* c:\target /s /y 2&amp;gt;&amp;amp;1";

data _null_;
infile oscmd;
input;
put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will copy all files in c:\source to c:\target, including all subdirectories. /y prevents prompting when a file already exists in the target.&lt;/P&gt;
&lt;P&gt;The filename pipe and data step are used to catch output from the command and write it to the SAS log; if you don't need that, you can issue the xcopy command in a X statement.&lt;/P&gt;
&lt;P&gt;I recommend doing the filename/data step method at least while testing.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 11:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353150#M82417</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-25T11:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353152#M82418</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/120326"&gt;@Rohit12&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;%let&lt;/SPAN&gt;&lt;SPAN&gt; source=c:\New folder;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;%let&lt;/SPAN&gt;&lt;SPAN&gt; target=c:\shubham;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&lt;SPAN&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; source ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;infile&lt;/SPAN&gt; &lt;SPAN&gt;"dir /b ""&amp;amp;source\"" "&lt;/SPAN&gt;&lt;SPAN&gt; pipe &lt;/SPAN&gt;&lt;SPAN&gt;truncover&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;input&lt;/SPAN&gt;&lt;SPAN&gt; fname &lt;/SPAN&gt;&lt;SPAN&gt;$256.&lt;/SPAN&gt;&lt;SPAN&gt; ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&lt;SPAN&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; target ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;infile&lt;/SPAN&gt; &lt;SPAN&gt;"dir /b ""&amp;amp;target\"" "&lt;/SPAN&gt;&lt;SPAN&gt; pipe &lt;/SPAN&gt;&lt;SPAN&gt;truncover&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;input&lt;/SPAN&gt;&lt;SPAN&gt; fname &lt;/SPAN&gt;&lt;SPAN&gt;$256.&lt;/SPAN&gt;&lt;SPAN&gt; ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&lt;SPAN&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; new;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;set&lt;/SPAN&gt;&lt;SPAN&gt; source ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;length&lt;/SPAN&gt;&lt;SPAN&gt; cmd1 &lt;/SPAN&gt;&lt;SPAN&gt;$100.&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp; cmd1 = catx(&lt;/SPAN&gt;&lt;SPAN&gt;' '&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'xcopy'&lt;/SPAN&gt;&lt;SPAN&gt;,quote(catx(&lt;/SPAN&gt;&lt;SPAN&gt;'\'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"&amp;amp;source"&lt;/SPAN&gt;&lt;SPAN&gt;,fname)),quote(&lt;/SPAN&gt;&lt;SPAN&gt;"&amp;amp;target"&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp; cmd= cat(&lt;/SPAN&gt;&lt;SPAN&gt;'X '&lt;/SPAN&gt;&lt;SPAN&gt;,cmd1);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;infile&lt;/SPAN&gt;&lt;SPAN&gt; cmd&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;filevar&lt;/SPAN&gt;&lt;SPAN&gt;=cmd &lt;/SPAN&gt;&lt;SPAN&gt;end&lt;/SPAN&gt;&lt;SPAN&gt;=eof ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;do&lt;/SPAN&gt; &lt;SPAN&gt;while&lt;/SPAN&gt;&lt;SPAN&gt; (not eof);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;input&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;put&lt;/SPAN&gt; &lt;SPAN&gt;_infile_&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;end&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;Below is the error that comes up&amp;nbsp;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;ERROR: Invalid physical name.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;fname=file1.txt cmd1=xcopy "c:\New folder\file1.txt" "c:\shubham"&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;cmd=X xcopy "c:\New folder\file1.txt" "c:\shubham" eof=0 _ERROR_=1 _INFILE_=&amp;nbsp; _N_=1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: There were 1 observations read from the data set WORK.SOURCE.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;WARNING: The data set WORK.NEW may be incomplete.&amp;nbsp; When this step was stopped there were 0&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; observations and 2 variables.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;WARNING: Data set WORK.NEW was not replaced because this step was stopped.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: DATA statement used (Total process time):&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;My goal is to copy all directories and subdirectories dynamically&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;how can I do that&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Looks to me like you want to execute the XCOPY with PIPE not X command.&amp;nbsp; See if this works...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new;
&amp;nbsp;&amp;nbsp; set source ;
&amp;nbsp;&amp;nbsp; length cmd1 $100.;
&amp;nbsp; cmd1 = catx(' ','xcopy',quote(catx('\',"&amp;amp;source",fname)),quote("&amp;amp;target"));
&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;infile dummy pipe filevar=cmd1 end=eof ;
&amp;nbsp;&amp;nbsp; do while (not eof);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put _infile_;
&amp;nbsp;&amp;nbsp; end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Notice the change to the INFILE statement.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 12:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/353152#M82418</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2017-04-25T12:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/354006#M82723</link>
      <description>&lt;P&gt;No it does not works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is the note &amp;nbsp;that is coming in &amp;nbsp;that's why it is not copying it&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The infile DUMMY is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unnamed Pipe Access Device,&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS=xcopy "c:\New folder\file1.txt" "c:\shubham",&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=256&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The infile DUMMY is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unnamed Pipe Access Device,&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS=xcopy "c:\New folder\file2.txt" "c:\shubham",&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RECFM=V,LRECL=256&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The infile DUMMY is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unnamed Pipe Access Device,&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS=xcopy "c:\New folder\great" "c:\shubham",&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=256&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The infile DUMMY is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unnamed Pipe Access Device,&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS=xcopy "c:\New folder\harnem.zip" "c:\shubham",&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=256&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The infile DUMMY is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unnamed Pipe Access Device,&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS=xcopy "c:\New folder\new file.txt" "c:\shubham",&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=256&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;NOTE: 0 records were read from the infile DUMMY.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;NOTE: 0 records were read from the infile DUMMY.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;NOTE: 0 records were read from the infile DUMMY.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;NOTE: 0 records were read from the infile DUMMY.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;NOTE: 0 records were read from the infile DUMMY.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;let &amp;nbsp;me know how can i correct this&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 08:11:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/354006#M82723</guid>
      <dc:creator>Rohit12</dc:creator>
      <dc:date>2017-04-27T08:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/354015#M82731</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/120326"&gt;@Rohit12&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;No it does not works&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;below is the note &amp;nbsp;that is coming in &amp;nbsp;that's why it is not copying it&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The infile DUMMY is:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unnamed Pipe Access Device,&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS=xcopy "c:\New folder\file1.txt" "c:\shubham",&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=256&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The infile DUMMY is:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unnamed Pipe Access Device,&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS=xcopy "c:\New folder\file2.txt" "c:\shubham",&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RECFM=V,LRECL=256&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The infile DUMMY is:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unnamed Pipe Access Device,&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS=xcopy "c:\New folder\great" "c:\shubham",&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=256&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The infile DUMMY is:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unnamed Pipe Access Device,&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS=xcopy "c:\New folder\harnem.zip" "c:\shubham",&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=256&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The infile DUMMY is:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unnamed Pipe Access Device,&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS=xcopy "c:\New folder\new file.txt" "c:\shubham",&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=256&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;NOTE: 0 records were read from the infile DUMMY.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;NOTE: 0 records were read from the infile DUMMY.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;NOTE: 0 records were read from the infile DUMMY.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;NOTE: 0 records were read from the infile DUMMY.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;NOTE: 0 records were read from the infile DUMMY.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;let &amp;nbsp;me know how can i correct this&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The fact that xcopy does not give you any output usually means it &lt;U&gt;worked as expected&lt;/U&gt;. Look in the target directory if the files are there.&lt;/P&gt;
&lt;P&gt;If they're not there, run xcopy from the commandline outside of SAS and see if you get error messages.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 08:51:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/354015#M82731</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-27T08:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/354019#M82735</link>
      <description>&lt;P&gt;And with xcopy, you do not have to iterate through a directory structure, as xcopy is specifically designed to do that on its own (different form the simple copy).&lt;/P&gt;
&lt;P&gt;Have you already tried this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename oscmd pipe 'xcopy "c:\New folder\*" "c:\shubham /s /y 2&amp;gt;&amp;amp;1';

data _null_;
infile oscmd;
input;
put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 09:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/354019#M82735</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-27T09:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/357863#M84056</link>
      <description>&lt;P&gt;I've tried Kurt Bremser's solution and it doesn't work for me. I alose get a note&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: 0 records were read from the infile OSCMD.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The destination folder remains empty. This is odd, the PIPE method works fine with other Windows shell commands such as copy, move, del.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A solution that does work is to sue robocopy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;robocopy "&amp;lt;source&amp;gt;" "&amp;lt;dest&amp;gt;" * /is
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Robocopy (Robust File Copy for Windows) does have a quirk, you can't use a double period to go up one level in your program path. It also produces more output but that's not necessarily a problem. I hadn't heard of it until today, documentation is at &lt;A href="https://technet.microsoft.com/nl-nl/library/cc733145(v=ws.10).aspx" target="_self"&gt;https://technet.microsoft.com/nl-nl/library/cc733145(v=ws.10).aspx&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What interests me is &lt;U&gt;why&lt;/U&gt; the xcopy command isn't being executed. Does anyone know?&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 12:53:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/357863#M84056</guid>
      <dc:creator>ckx</dc:creator>
      <dc:date>2017-05-11T12:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/357869#M84059</link>
      <description>&lt;P&gt;Test the xcopy from the commandline before running it from SAS. Basically, the 2&amp;gt;&amp;amp;1 at the end of the command should redirect error messages to the pipe, though, so if something is amiss SAS should catch it.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 13:02:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/357869#M84059</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-11T13:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/357884#M84067</link>
      <description>&lt;P&gt;Hi Kurt,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The xcopy command does work from a command line or if modified to a robocopy command. What's telling is the message "&lt;FONT face="courier new,courier"&gt;0 records were read&lt;/FONT&gt;". The command isn't generating an error, it's being completely ignored. But the equivalent robocopy command does work!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does the xcopy command work for you? If so, what version of SAS are you using and on which platform? I'm using SAS 9.4M1 on a Windows 2008 server. I'm using Enterprise Guide but with the "xcmd" option enabled (by default, Enterprise Guide won't let you execute shell commands but our SAS administrator enabled this option).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 13:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/357884#M84067</guid>
      <dc:creator>ckx</dc:creator>
      <dc:date>2017-05-11T13:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/357894#M84069</link>
      <description>&lt;P&gt;Wow. I just checked and couldn't believe it. While other things work as they should, xcopy obviously plays "dead" when run from SAS. I simply couldn't believe that such a simple utility would do that.&lt;/P&gt;
&lt;P&gt;Even after making sure that no further input would be expected from me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank $DEITY I don't have to put up with such crap. My SAS runs on UNIX.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 13:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/357894#M84069</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-11T13:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/357918#M84074</link>
      <description>&lt;P&gt;Can you use COPY to copy any of the files?&lt;/P&gt;
&lt;P&gt;Perhaps it is a permission issue with the account that your SAS server is using?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/24485086/xcopy-does-not-copy-all-files" target="_blank"&gt;http://stackoverflow.com/questions/24485086/xcopy-does-not-copy-all-files&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 14:35:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/357918#M84074</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-11T14:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Copy directories and sub directories dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/357951#M84085</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Can you use COPY to copy any of the files?&lt;/P&gt;
&lt;P&gt;Perhaps it is a permission issue with the account that your SAS server is using?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/24485086/xcopy-does-not-copy-all-files" target="_blank"&gt;http://stackoverflow.com/questions/24485086/xcopy-does-not-copy-all-files&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's not that xcopy fails for some files or has any problems. It does NOTHING. There's not even a message from the system that it couldn't be executed. Windows at work, once again.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 15:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-directories-and-sub-directories-dynamically/m-p/357951#M84085</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-11T15:25:25Z</dc:date>
    </item>
  </channel>
</rss>

