<?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: fcopy with directory paths in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/865170#M341648</link>
    <description>&lt;P&gt;Works great, Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 20 Mar 2023 11:09:47 GMT</pubDate>
    <dc:creator>Taliah</dc:creator>
    <dc:date>2023-03-20T11:09:47Z</dc:date>
    <item>
      <title>fcopy with directory paths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/865144#M341641</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I need to copy a text file from one directory to another (in linux). I am using the following code -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;filename&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;infile&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"/cifs/test1/test2/test3/test.txt";&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;filename&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;outfile&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"/cifs//test10/test20/test30/test.txt";&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;_null_&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;rc = fcopy(infile, outfile);&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;I get rc 2004, and the file isn't copied. All help will be&amp;nbsp;appreciate, Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 09:06:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/865144#M341641</guid>
      <dc:creator>Taliah</dc:creator>
      <dc:date>2023-03-20T09:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: fcopy with directory paths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/865150#M341645</link>
      <description>&lt;P&gt;The arguments to the FCOPY functions are character values, so they must be quoted, see example below. I would also recommend to use the SYSMSG function to get the proper error message back that corresponds to the return code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data msg;
  rc=fcopy("infile", "outfile");
  length msg $ 1024;
  msg=sysmsg();
  putlog _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Mar 2023 10:14:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/865150#M341645</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2023-03-20T10:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: fcopy with directory paths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/865170#M341648</link>
      <description>&lt;P&gt;Works great, Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 11:09:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/865170#M341648</guid>
      <dc:creator>Taliah</dc:creator>
      <dc:date>2023-03-20T11:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: fcopy with directory paths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/891802#M352272</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just trued this solution:&lt;/P&gt;&lt;P&gt;data msg;&lt;BR /&gt;rc=fcopy("C:\My Documents\schedule.txt", "C:\My Documents\Reports\schedule.txt");&lt;BR /&gt;length msg $ 1024;&lt;BR /&gt;msg=sysmsg();&lt;BR /&gt;putlog _all_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And received this SAS EG output:&lt;/P&gt;&lt;P&gt;rc msg&lt;BR /&gt;20004 ERROR: No logical assign for filename C:\MY.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 20:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/891802#M352272</guid>
      <dc:creator>Hdababs</dc:creator>
      <dc:date>2023-08-30T20:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: fcopy with directory paths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/891806#M352274</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/438853"&gt;@Hdababs&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Greetings,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just trued this solution:&lt;/P&gt;
&lt;P&gt;data msg;&lt;BR /&gt;rc=fcopy("C:\My Documents\schedule.txt", "C:\My Documents\Reports\schedule.txt");&lt;BR /&gt;length msg $ 1024;&lt;BR /&gt;msg=sysmsg();&lt;BR /&gt;putlog _all_;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And received this SAS EG output:&lt;/P&gt;
&lt;P&gt;rc msg&lt;BR /&gt;20004 ERROR: No logical assign for filename C:\MY.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That cannot work because that is not what FCOPY wants as INPUT.&amp;nbsp; It wants the names of the FILEREF you created with the FILENAME statement or FILENAME() function.&amp;nbsp;&amp;nbsp;Instead you gave it the actual path to the file.&amp;nbsp; The error message is clearly saying there is no fileref named "C:\MY" (and there never could be since : and \ are not valid characters to use in a fileref).&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 20:40:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/891806#M352274</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-08-30T20:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: fcopy with directory paths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/891810#M352277</link>
      <description>&lt;P&gt;Thank you. If I understand correct, I need to declare infile and outfile variables for the directory path for the source and destination.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 22:09:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/891810#M352277</guid>
      <dc:creator>Hdababs</dc:creator>
      <dc:date>2023-08-30T22:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: fcopy with directory paths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/891813#M352279</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/438853"&gt;@Hdababs&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you. If I understand correct, I need to declare infile and outfile variables for the directory path for the source and destination.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Kind of.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;You need to DEFINE two filerefs.&amp;nbsp; You can use INFILE and OUTFILE for them if you want (make sure you aren't already using those names for some other files that you still need to reference.).&amp;nbsp; Or you can use any other valid SAS names that is 8 characters or less as the filerefs.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 22:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fcopy-with-directory-paths/m-p/891813#M352279</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-08-30T22:43:49Z</dc:date>
    </item>
  </channel>
</rss>

