<?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: I want to copy all the directories within a folder to another folder in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/352094#M82037</link>
    <description>&lt;P&gt;In SAS:&lt;/P&gt;
&lt;P&gt;x 'copy "&amp;lt;path&amp;gt;" "&amp;lt;topath&amp;gt;"';&lt;/P&gt;
&lt;P&gt;It is using the Operating System copy command.&lt;/P&gt;
&lt;P&gt;Do bear in mind per my previous post, if the folders exist, you dont have access, something is open within them and any other number of things the process will fail - hence why I again suggest you fix your process rather than try to use a third party tool to do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Apr 2017 09:35:18 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-04-21T09:35:18Z</dc:date>
    <item>
      <title>I want to copy all the directories within a folder to another folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/351618#M81852</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to copy all the files from one folder to another folder&amp;nbsp;&lt;/P&gt;&lt;P&gt;for ex-C:\old folder&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want all the the &amp;nbsp;folder and file to be copied from old folder to new folder in the C drive&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using below code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;let&lt;/SPAN&gt;&lt;SPAN&gt; source=c:\old folder ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%let&lt;/SPAN&gt;&lt;SPAN&gt; target=c:\new folder ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;SPAN&gt; source ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &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&gt;&amp;nbsp; &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&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;SPAN&gt; target ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &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&gt;&amp;nbsp; &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&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt; &lt;SPAN&gt;noprint&lt;/SPAN&gt;&lt;SPAN&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN&gt;create&lt;/SPAN&gt; &lt;SPAN&gt;table&lt;/SPAN&gt;&lt;SPAN&gt; newfiles &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN&gt;select&lt;/SPAN&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; source&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN&gt;where&lt;/SPAN&gt; &lt;SPAN&gt;not&lt;/SPAN&gt;&lt;SPAN&gt; (upcase(fname) &lt;/SPAN&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;select&lt;/SPAN&gt;&lt;SPAN&gt; upcase(fname) &lt;/SPAN&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; target ) )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; &lt;SPAN&gt;_null_&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN&gt;set&lt;/SPAN&gt;&lt;SPAN&gt; newfiles ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; cmd = catx(&lt;/SPAN&gt;&lt;SPAN&gt;' '&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'copy'&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&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN&gt;infile&lt;/SPAN&gt;&lt;SPAN&gt; cmd pipe &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&gt;&amp;nbsp;&amp;nbsp; &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&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN&gt;input&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN&gt;end&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the problem that I am facing is that&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a) if there is folder called &amp;nbsp;&lt;STRONG&gt;great&lt;/STRONG&gt; and inside it has file &lt;STRONG&gt;new.txt&lt;/STRONG&gt; &amp;nbsp;in &lt;STRONG&gt;C;\old folder&lt;/STRONG&gt; then it copies in new path as &lt;STRONG&gt;new.txt&lt;/STRONG&gt; but it can not creates &amp;nbsp;&lt;STRONG&gt;new.txt in a folder called great&lt;/STRONG&gt; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b) If I run my above program again it does not replace the file with the new one&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please let em know how can I acheive ths&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 11:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/351618#M81852</guid>
      <dc:creator>Rohit12</dc:creator>
      <dc:date>2017-04-20T11:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: I want to copy all the directories within a folder to another folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/351630#M81859</link>
      <description>&lt;P&gt;Since you have commandline access (XCMD) anyway, use xcopy. Much easier.&lt;/P&gt;
&lt;P&gt;And your problem b) is caused by the condition in your proc sql, which explicitly excludes files that already exist in target.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 11:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/351630#M81859</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-20T11:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: I want to copy all the directories within a folder to another folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/351655#M81869</link>
      <description>&lt;P&gt;The question arises to me, why? &amp;nbsp;SAS is not the best tool for operating system management, it can do it, but if your doing that in a third party tool questions should be jumping to mind as to why. &amp;nbsp;Why those folders, do they need to be empty? &amp;nbsp;If they are duplicating, again why, if its datasets, you can do that in datastep, if its other files what else is going wrong to make you waant to copy them etc.&lt;/P&gt;
&lt;P&gt;If you just need a fixed structure, you would be bettter off writing a small batch file to populate it.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 13:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/351655#M81869</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-20T13:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: I want to copy all the directories within a folder to another folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/352093#M82036</link>
      <description>&lt;P&gt;How can I do this thing through XCOPY .could you help me out ?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 09:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/352093#M82036</guid>
      <dc:creator>Rohit12</dc:creator>
      <dc:date>2017-04-21T09:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: I want to copy all the directories within a folder to another folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/352094#M82037</link>
      <description>&lt;P&gt;In SAS:&lt;/P&gt;
&lt;P&gt;x 'copy "&amp;lt;path&amp;gt;" "&amp;lt;topath&amp;gt;"';&lt;/P&gt;
&lt;P&gt;It is using the Operating System copy command.&lt;/P&gt;
&lt;P&gt;Do bear in mind per my previous post, if the folders exist, you dont have access, something is open within them and any other number of things the process will fail - hence why I again suggest you fix your process rather than try to use a third party tool to do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 09:35:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/352094#M82037</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-21T09:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: I want to copy all the directories within a folder to another folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/352097#M82039</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;How can I do this thing through XCOPY .could you help me out ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Gosh, you young padawans are so helpless at times!&lt;/P&gt;
&lt;P&gt;Google for "Windows xcopy reference", and follow the links. The first one will be the MS reference page from Windows XP with lots of examples; I take it that not much has changed since then.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 10:20:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-copy-all-the-directories-within-a-folder-to-another/m-p/352097#M82039</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-21T10:20:43Z</dc:date>
    </item>
  </channel>
</rss>

