<?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 Download file from ftp area in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199252#M58257</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a possible solution based on VBScript function.&lt;/P&gt;&lt;P&gt;I defined this macro:&lt;/P&gt;&lt;P&gt;Function ftpList(ftpServer, ftpPort, ftpUser, ftpPwd, ftpRemotePath)&lt;BR /&gt; Const OpenAsDefault = -2&lt;BR /&gt; Const FailIfNotExist = 0&lt;BR /&gt; Const ForReading = 1&lt;BR /&gt; Const ForWriting = 2&lt;BR /&gt;&lt;BR /&gt; Set oFTPScriptFSO = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt; Set oFTPScriptShell = CreateObject("WScript.Shell")&lt;BR /&gt;&lt;BR /&gt; 'build input file for ftp command&lt;BR /&gt; sFTPScript = sFTPScript &amp;amp; "USER " &amp;amp; ftpUser &amp;amp; vbCRLF&lt;BR /&gt; sFTPScript = sFTPScript &amp;amp; ftpPwd &amp;amp; vbCRLF&lt;BR /&gt; sFTPScript = sFTPScript &amp;amp; "cd " &amp;amp; ftpRemotePath &amp;amp; vbCRLF&lt;BR /&gt; sFTPScript = sFTPScript &amp;amp; "ls" &amp;amp; vbCRLF&lt;BR /&gt; sFTPScript = sFTPScript &amp;amp; "quit" &amp;amp; vbCRLF &amp;amp; "quit" &amp;amp; vbCRLF &amp;amp; "quit" &amp;amp; vbCRLF&lt;BR /&gt;&lt;BR /&gt; sFTPTemp = oFTPScriptShell.ExpandEnvironmentStrings("%TEMP%")&lt;BR /&gt; sFTPTempFile = sFTPTemp &amp;amp; "\" &amp;amp; oFTPScriptFSO.GetTempName&lt;BR /&gt; sFTPResults = sFTPTemp &amp;amp; "\" &amp;amp; oFTPScriptFSO.GetTempName&lt;BR /&gt;&lt;BR /&gt; 'Write the input file for the ftp command&lt;BR /&gt; 'to a temporary file.&lt;BR /&gt; Set fFTPScript = oFTPScriptFSO.CreateTextFile(sFTPTempFile, True)&lt;BR /&gt; fFTPScript.WriteLine(sFTPScript)&lt;BR /&gt; fFTPScript.Close&lt;BR /&gt; Set fFTPScript = Nothing&lt;BR /&gt;&lt;BR /&gt; oFTPScriptShell.Run "%comspec% /c FTP -n -v -s:" &amp;amp; sFTPTempFile &amp;amp; " " &amp;amp; ftpServer &amp;amp; " &amp;gt; " &amp;amp; sFTPResults, 0, TRUE&lt;BR /&gt;&lt;BR /&gt; ftpList = sFTPResults&lt;BR /&gt; End Function&lt;/P&gt;&lt;P&gt;this macro connects to ftp site using &lt;A&gt;ftp.exe&lt;/A&gt; and executes command "ls"; the output is sored in a temporary file. The function returns full path and filename of temporary output file.&lt;/P&gt;&lt;P&gt;You can call this macro in your QlikView script as in this example:&lt;/P&gt;&lt;P&gt;LET tempFile = ftpList('172.23.56.76', '21', 'root', 'root', '/tmp');&lt;BR /&gt;&lt;BR /&gt; ftpFilesList:&lt;BR /&gt; LOAD @1 as fileName&lt;BR /&gt; FROM&lt;BR /&gt; $(tempFile)&lt;BR /&gt; (txt, codepage is 1252, no labels, delimiter is ',', msq)&lt;BR /&gt; Where Left(@1, 4) &amp;lt;&amp;gt; 'ftp&amp;gt;' and @1 &amp;lt;&amp;gt; 'quit';&lt;BR /&gt;&lt;BR /&gt; let tempFile = null();&lt;/P&gt;&lt;P&gt;This solution stores in a table all files found in FTP server; you can filter results using where conditions; for example, if you need only "*.csv" files, you can add this condition:&lt;/P&gt;&lt;P&gt;Where Left(@1, 4) &amp;lt;&amp;gt; 'ftp&amp;gt;' and @1 &amp;lt;&amp;gt; 'quit' and @1 like '*.csv';&lt;BR /&gt;&lt;BR /&gt;This solution doesn't handle FTP connection errors, but you can chek it in "ftpFilesList" output table.&lt;BR /&gt;You can iterate on all rows of "ftpFilesList" table to read al files content usinf "LOAD" syntax&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Feb 2011 15:58:19 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-02-08T15:58:19Z</dc:date>
    <item>
      <title>Download file from ftp area</title>
      <link>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199250#M58255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, I have to load from ftp area some files.&lt;/P&gt;&lt;P&gt;This is my script:&lt;/P&gt;&lt;P&gt;let path = 'ftp://user:pwd@ftp_area.dominio.it'&lt;/P&gt;&lt;P&gt;for each File in filelist ('$(path)pattern*.csv')&lt;/P&gt;&lt;P&gt;let CurrentFileName = '$(File)';&lt;/P&gt;&lt;P&gt;QV_Table:&lt;/P&gt;&lt;P&gt;LOAD * FROM [$(CurrentFileName)] (txt, codepage is 1252, embedded labels, delimiter is ';', msq); Next File ;&lt;/P&gt;&lt;P&gt;The script have not errors, but not find any files. (I'm sure that the files are present)&lt;/P&gt;&lt;P&gt;Any suggestion? Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Sep 2010 16:44:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199250#M58255</guid>
      <dc:creator />
      <dc:date>2010-09-13T16:44:25Z</dc:date>
    </item>
    <item>
      <title>Download file from ftp area</title>
      <link>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199251#M58256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've a similar problem. I'm trying load several files from an FTP Server. First attempt: to use wildcards in the filename.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;LOAD * FROM [ftp://user:pwd@ftp_area.dominio.it/pattern*.csv] (txt, codepage is 1252, embedded labels, delimiter is ';', msq);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I get "Cannot open file" (everything goes fine without wildcards). Wildcards work fine for local directories.&lt;/P&gt;&lt;P&gt;Using FOR EACH and Filelist I get the same result that dp2000: no error but no file is retrieved.&lt;/P&gt;&lt;P&gt;Seems that Filelist doesn't work with FTP.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Sep 2010 14:54:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199251#M58256</guid>
      <dc:creator />
      <dc:date>2010-09-30T14:54:09Z</dc:date>
    </item>
    <item>
      <title>Download file from ftp area</title>
      <link>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199252#M58257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a possible solution based on VBScript function.&lt;/P&gt;&lt;P&gt;I defined this macro:&lt;/P&gt;&lt;P&gt;Function ftpList(ftpServer, ftpPort, ftpUser, ftpPwd, ftpRemotePath)&lt;BR /&gt; Const OpenAsDefault = -2&lt;BR /&gt; Const FailIfNotExist = 0&lt;BR /&gt; Const ForReading = 1&lt;BR /&gt; Const ForWriting = 2&lt;BR /&gt;&lt;BR /&gt; Set oFTPScriptFSO = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt; Set oFTPScriptShell = CreateObject("WScript.Shell")&lt;BR /&gt;&lt;BR /&gt; 'build input file for ftp command&lt;BR /&gt; sFTPScript = sFTPScript &amp;amp; "USER " &amp;amp; ftpUser &amp;amp; vbCRLF&lt;BR /&gt; sFTPScript = sFTPScript &amp;amp; ftpPwd &amp;amp; vbCRLF&lt;BR /&gt; sFTPScript = sFTPScript &amp;amp; "cd " &amp;amp; ftpRemotePath &amp;amp; vbCRLF&lt;BR /&gt; sFTPScript = sFTPScript &amp;amp; "ls" &amp;amp; vbCRLF&lt;BR /&gt; sFTPScript = sFTPScript &amp;amp; "quit" &amp;amp; vbCRLF &amp;amp; "quit" &amp;amp; vbCRLF &amp;amp; "quit" &amp;amp; vbCRLF&lt;BR /&gt;&lt;BR /&gt; sFTPTemp = oFTPScriptShell.ExpandEnvironmentStrings("%TEMP%")&lt;BR /&gt; sFTPTempFile = sFTPTemp &amp;amp; "\" &amp;amp; oFTPScriptFSO.GetTempName&lt;BR /&gt; sFTPResults = sFTPTemp &amp;amp; "\" &amp;amp; oFTPScriptFSO.GetTempName&lt;BR /&gt;&lt;BR /&gt; 'Write the input file for the ftp command&lt;BR /&gt; 'to a temporary file.&lt;BR /&gt; Set fFTPScript = oFTPScriptFSO.CreateTextFile(sFTPTempFile, True)&lt;BR /&gt; fFTPScript.WriteLine(sFTPScript)&lt;BR /&gt; fFTPScript.Close&lt;BR /&gt; Set fFTPScript = Nothing&lt;BR /&gt;&lt;BR /&gt; oFTPScriptShell.Run "%comspec% /c FTP -n -v -s:" &amp;amp; sFTPTempFile &amp;amp; " " &amp;amp; ftpServer &amp;amp; " &amp;gt; " &amp;amp; sFTPResults, 0, TRUE&lt;BR /&gt;&lt;BR /&gt; ftpList = sFTPResults&lt;BR /&gt; End Function&lt;/P&gt;&lt;P&gt;this macro connects to ftp site using &lt;A&gt;ftp.exe&lt;/A&gt; and executes command "ls"; the output is sored in a temporary file. The function returns full path and filename of temporary output file.&lt;/P&gt;&lt;P&gt;You can call this macro in your QlikView script as in this example:&lt;/P&gt;&lt;P&gt;LET tempFile = ftpList('172.23.56.76', '21', 'root', 'root', '/tmp');&lt;BR /&gt;&lt;BR /&gt; ftpFilesList:&lt;BR /&gt; LOAD @1 as fileName&lt;BR /&gt; FROM&lt;BR /&gt; $(tempFile)&lt;BR /&gt; (txt, codepage is 1252, no labels, delimiter is ',', msq)&lt;BR /&gt; Where Left(@1, 4) &amp;lt;&amp;gt; 'ftp&amp;gt;' and @1 &amp;lt;&amp;gt; 'quit';&lt;BR /&gt;&lt;BR /&gt; let tempFile = null();&lt;/P&gt;&lt;P&gt;This solution stores in a table all files found in FTP server; you can filter results using where conditions; for example, if you need only "*.csv" files, you can add this condition:&lt;/P&gt;&lt;P&gt;Where Left(@1, 4) &amp;lt;&amp;gt; 'ftp&amp;gt;' and @1 &amp;lt;&amp;gt; 'quit' and @1 like '*.csv';&lt;BR /&gt;&lt;BR /&gt;This solution doesn't handle FTP connection errors, but you can chek it in "ftpFilesList" output table.&lt;BR /&gt;You can iterate on all rows of "ftpFilesList" table to read al files content usinf "LOAD" syntax&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Feb 2011 15:58:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199252#M58257</guid>
      <dc:creator />
      <dc:date>2011-02-08T15:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Download file from ftp area</title>
      <link>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199253#M58258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="color: #333333; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt; mso-ansi-language: EN-US;"&gt;Hi atrapanese:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="color: #333333; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt; mso-ansi-language: EN-US;"&gt;I´ve tried the macro and it works but it only brings the names of the files. Now I need to get the content of the file. I only need a file and I know the name of the file. What should I do?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12pt; mso-ansi-language: EN-US; font-family: Times New Roman;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="color: #333333; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt; mso-ansi-language: EN-US;"&gt;Thanks a lot.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2012 09:29:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199253#M58258</guid>
      <dc:creator>christian77</dc:creator>
      <dc:date>2012-06-05T09:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Download file from ftp area</title>
      <link>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199254#M58259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://community.qlik.com/people/atrapanese" id="jive-334571895269858649721" style="background-color: #f9f9f9; font-size: 12px; color: #007fc0; font-weight: bold; font-family: Arial; text-align: center;"&gt;atrapanese&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you please give an iteration example to use all rows of "ftpFilesList".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Asim Akin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2012 19:38:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199254#M58259</guid>
      <dc:creator />
      <dc:date>2012-09-24T19:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: Download file from ftp area</title>
      <link>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199255#M58260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;A _jive_internal="true" href="https://community.qlik.com/people/atrapanese"&gt;atrapanese&lt;/A&gt;, 10X that what I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class="jive-username-link-wrapper"&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://community.qlik.com/people/asim.akin" id="jive-8012024934904645375253" onmouseout="" onmouseover=""&gt;asim.akin&lt;/A&gt;, try this way:&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ftpFilesList:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;@1 as fileName&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;$(tempFile)&lt;/P&gt;&lt;P&gt;(txt, codepage is 1252, no labels, delimiter is ',', msq)&lt;/P&gt;&lt;P&gt;Where&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Left(@1, 4) &amp;lt;&amp;gt; 'ftp&amp;gt;'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; and @1 &amp;lt;&amp;gt; 'quit'&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let tempFile = null();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRACE ==========;&lt;/P&gt;&lt;P&gt;Let vFoldersNo = FieldValueCount('fileName');&lt;/P&gt;&lt;P&gt;TRACE Folders count: $(vFoldersNo);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR i=1 to vFoldersNo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let vFolderName = FieldValue('fileName', i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRACE Folder name: $(vFolderName);&lt;/P&gt;&lt;P&gt;NEXT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 11:42:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199255#M58260</guid>
      <dc:creator />
      <dc:date>2013-06-18T11:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Download file from ftp area</title>
      <link>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199256#M58261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you share sample QVW file&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 06:33:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199256#M58261</guid>
      <dc:creator>pandiarajan</dc:creator>
      <dc:date>2014-04-02T06:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Download file from ftp area</title>
      <link>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199257#M58262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can&amp;nbsp; you share sample QVW file@Alan Trapanese&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 06:34:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Download-file-from-ftp-area/m-p/199257#M58262</guid>
      <dc:creator>pandiarajan</dc:creator>
      <dc:date>2014-04-02T06:34:25Z</dc:date>
    </item>
  </channel>
</rss>

