<?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: How to copy a file from FTP server to Local machine in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269638#M53450</link>
    <description>And there's also the filename ftp engine.</description>
    <pubDate>Wed, 11 May 2016 05:30:39 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2016-05-11T05:30:39Z</dc:date>
    <item>
      <title>How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269625#M53442</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to copy a file from FTP server (Unix) to local machine (Windows) using SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are many files loaded in FTP server daily. So, I want just to copy the latest file from FTP to local machine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently, I have to manually copy from Unix server to Windows using FTP (Tectia).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Nikunj&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 04:11:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269625#M53442</guid>
      <dc:creator>nikunjgattani</dc:creator>
      <dc:date>2016-05-11T04:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269626#M53443</link>
      <description>&lt;P&gt;If you can create a script on Windows or Unix side to do the job, its relatively easy to execute the script from SAS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's probably the ideal solution. You can also pass unix commands directly to the server or windows so if you can utilize x command you can pass the unix command to download the data as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In SAS 9.4+ there's FCOPY which will move files.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/67960/HTML/default/viewer.htm#n10dz22b5ixohin1vwzilweetek0.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/67960/HTML/default/viewer.htm#n10dz22b5ixohin1vwzilweetek0.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 04:17:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269626#M53443</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-11T04:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269628#M53445</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank You.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If possible, could you provide me unix code as i am not good with Unix.&lt;/P&gt;
&lt;P&gt;So that I can make changes accordingly on that code and try it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nikunj&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 04:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269628#M53445</guid>
      <dc:creator>nikunjgattani</dc:creator>
      <dc:date>2016-05-11T04:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269629#M53446</link>
      <description>&lt;P&gt;Sorry, I'm not great with Unix. It's also dependent on your application.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sure if you searched on StackOverflow you'd find examples of what the commands should look like.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would FCOPY work for you? Does your Base SAS see your server and your desktop at the same time? Or do you not have SAS 9.4?&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 04:36:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269629#M53446</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-11T04:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269631#M53447</link>
      <description>&lt;P&gt;If you have EG you can use this add in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/sasdummy/2012/12/06/copy-files-in-sas-eg/" target="_blank"&gt;http://blogs.sas.com/content/sasdummy/2012/12/06/copy-files-in-sas-eg/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC DOWNLOAD if you have the license for SAS/CONNECT&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi30/023-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/023-30.pdf&lt;/A&gt; (top of page 6)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Google search results (untested):&lt;/P&gt;
&lt;P&gt;&lt;A href="http://snipplr.com/view/42667/sas-macro-to-ftp-files-between-pc-and-unix-or-among-unix-server-locations/" target="_blank"&gt;http://snipplr.com/view/42667/sas-macro-to-ftp-files-between-pc-and-unix-or-among-unix-server-locations/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 04:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269631#M53447</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-11T04:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269634#M53448</link>
      <description>&lt;P&gt;Windows ftp can be scripted with the -s:scriptfile commandline option.&lt;/P&gt;
&lt;P&gt;Since you will only use the Windows client, no UNIX knowledge apart from file/pathnames is required.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 04:54:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269634#M53448</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-05-11T04:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269638#M53450</link>
      <description>And there's also the filename ftp engine.</description>
      <pubDate>Wed, 11 May 2016 05:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269638#M53450</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-11T05:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269672#M53459</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why would you need to do it in SAS? &amp;nbsp;You have an FTP program, just script it within that, then schedule that script to run as and when you need. &amp;nbsp;Including another application (SAS) in the process just means another step which needs documenting, creating, and validating. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 09:26:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269672#M53459</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-11T09:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269678#M53461</link>
      <description>&lt;P&gt;I agree with you RW9.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even I tried the following code and create a batch of it for testing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;scpg3 host_server_name:/home/abcd/test.txt C:\abcd\Desktop&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, the issue is there are lot of files in the unix folder. I want the latest uploaded file only and with particular prefix.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have any code for the same.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 09:37:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269678#M53461</guid>
      <dc:creator>nikunjgattani</dc:creator>
      <dc:date>2016-05-11T09:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269682#M53463</link>
      <description>&lt;P&gt;How do you know which is the latest file? Does your prefix/naming convention include the date?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 09:44:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269682#M53463</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-11T09:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269683#M53464</link>
      <description>&lt;P&gt;Hi Reez,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes prefix has date stamp.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if possible, we can get the modification time of the file. If it is of today then we will copy it.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 09:48:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269683#M53464</guid>
      <dc:creator>nikunjgattani</dc:creator>
      <dc:date>2016-05-11T09:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269685#M53465</link>
      <description>&lt;P&gt;Its quite dependant on what you are using as the FTP software. &amp;nbsp;I did it many years back in Reflections - VB scripting, so thats not going to be much help. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Google throws up a lot of results, this one for instance:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.dreamincode.net/forums/topic/350239-download-last-modified-file-from-ftp-server/" target="_blank"&gt;http://www.dreamincode.net/forums/topic/350239-download-last-modified-file-from-ftp-server/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Or WinSCP:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://winscp.net/eng/docs/script_download_most_recent_file" target="_blank"&gt;https://winscp.net/eng/docs/script_download_most_recent_file&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 09:59:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269685#M53465</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-11T09:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy a file from FTP server to Local machine</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269691#M53466</link>
      <description>&lt;P&gt;Thanks all for your help and quick responses.&lt;/P&gt;
&lt;P&gt;I have prepared a scp command line code. Also, files which i wanted to download has date prefix.. so that will also help me to copy the desired files only.&lt;/P&gt;
&lt;P&gt;THANKS ALL again for their valuable advice.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 10:43:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-a-file-from-FTP-server-to-Local-machine/m-p/269691#M53466</guid>
      <dc:creator>nikunjgattani</dc:creator>
      <dc:date>2016-05-11T10:43:37Z</dc:date>
    </item>
  </channel>
</rss>

