<?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>question Re: How to download files from sftp, with last modified time X hours. in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151698#M56794</link>
    <description>&lt;A rel="user" href="https://community.cloudera.com/users/16489/kumarv0686.html" nodeid="16489" target="_blank"&gt;@vikash kumar&lt;/A&gt;&lt;P&gt;You can use the ListSFTP processor to list all files on your SFTP server.   The ListSFTP processor will create a 0 byte file with the following additional attributes written to it:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="13496-screen-shot-2017-03-10-at-103409-am.png" style="width: 2112px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/21155i6197C0446560C32B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="13496-screen-shot-2017-03-10-at-103409-am.png" alt="13496-screen-shot-2017-03-10-at-103409-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Take the success relationship of the ListSFTP and send it to a routeOnAttribute processor.&lt;/P&gt;&lt;P&gt;Use the routeOnAttribute processor to route on those FlowFiles where the attribute "file.lastModifiedTime" date falls within your desired range to a FetchSFTP processor.  All other listed files could just be auto-terminated.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
    <pubDate>Sun, 18 Aug 2019 12:52:21 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2019-08-18T12:52:21Z</dc:date>
    <item>
      <title>How to download files from sftp, with last modified time X hours.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151697#M56793</link>
      <description>&lt;P&gt;Current setup is using getSftp --&amp;gt; puSFTP to sync data from sftp server to a remote linux host.&lt;/P&gt;&lt;P&gt;Problem is with getSFTP i cannot define File age i wish to download, though i found getFile has the min max file age option, however nifi doesn't allow on canvas link between getSFTP and getFile.&lt;/P&gt;&lt;P&gt;I was wondering how i can accomplish this, thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 23:29:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151697#M56793</guid>
      <dc:creator>kumarv0686</dc:creator>
      <dc:date>2017-03-10T23:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to download files from sftp, with last modified time X hours.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151698#M56794</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/16489/kumarv0686.html" nodeid="16489" target="_blank"&gt;@vikash kumar&lt;/A&gt;&lt;P&gt;You can use the ListSFTP processor to list all files on your SFTP server.   The ListSFTP processor will create a 0 byte file with the following additional attributes written to it:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="13496-screen-shot-2017-03-10-at-103409-am.png" style="width: 2112px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/21155i6197C0446560C32B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="13496-screen-shot-2017-03-10-at-103409-am.png" alt="13496-screen-shot-2017-03-10-at-103409-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Take the success relationship of the ListSFTP and send it to a routeOnAttribute processor.&lt;/P&gt;&lt;P&gt;Use the routeOnAttribute processor to route on those FlowFiles where the attribute "file.lastModifiedTime" date falls within your desired range to a FetchSFTP processor.  All other listed files could just be auto-terminated.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 12:52:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151698#M56794</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2019-08-18T12:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to download files from sftp, with last modified time X hours.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151699#M56795</link>
      <description>&lt;P&gt;Thanks Matt, i added the processors you recommended, but the Route on attribute processor is compaining about "file.lastmodified validated against '2017-03-08'T'11:00:00Z' is invalid because no Expressions found.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2017 02:33:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151699#M56795</guid>
      <dc:creator>kumarv0686</dc:creator>
      <dc:date>2017-03-11T02:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to download files from sftp, with last modified time X hours.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151700#M56796</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/16489/kumarv0686.html" nodeid="16489"&gt;@vikash kumar&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Can you share the NiFi expression language routing rule you created in your RouteOnAttribute processor? The rule must evaluate to "true" before a FlowFile will be routed to that relationship.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2017 02:43:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151700#M56796</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2017-03-11T02:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to download files from sftp, with last modified time X hours.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151701#M56797</link>
      <description>&lt;P&gt;sure, here they are &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="13500-data-from-sftp.jpg" style="width: 365px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/21153i781D5166742A02B5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="13500-data-from-sftp.jpg" alt="13500-data-from-sftp.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="13511-routeonattribute.jpg" style="width: 666px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/21154i994F1B715C9882ED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="13511-routeonattribute.jpg" alt="13511-routeonattribute.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 12:52:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151701#M56797</guid>
      <dc:creator>kumarv0686</dc:creator>
      <dc:date>2019-08-18T12:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to download files from sftp, with last modified time X hours.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151702#M56798</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/questions/88206/how-to-download-files-from-sftp-with-last-modified.html#"&gt;@vikash kumar&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;Are you looking for files where the "file.lastModifiedTime" is exactly 2017-03-08'T'11:00:00Z?&lt;/P&gt;&lt;P&gt;Or are you looking for all files created at that time and newer?&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2017 03:40:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151702#M56798</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2017-03-11T03:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to download files from sftp, with last modified time X hours.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151703#M56799</link>
      <description>&lt;P&gt;@Matt Clarke i am looking for the files uploaded on the source sftp in last 24 hours, thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2017 03:45:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151703#M56799</guid>
      <dc:creator>kumarv0686</dc:creator>
      <dc:date>2017-03-11T03:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to download files from sftp, with last modified time X hours.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151704#M56800</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/16489/kumarv0686.html" nodeid="16489" target="_blank"&gt;@vikash kumar&lt;/A&gt; &lt;/P&gt;&lt;P&gt;The RouteOnAttribute processor expects that a NiFi expression Language statement is used.  If the the evaluation of that EL statement results in a true, then the FlowFile will be routed to the corresponding property name's relationship.&lt;/P&gt;&lt;P&gt;Here is an example that will route FlowFile where the value associated to "file.lastModifiedTime" on the incoming FlowFile falls within the last 24 hours to the 
"last24hours" relationship:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="13512-screen-shot-2017-03-10-at-33350-pm.png" style="width: 1066px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/21152i536786F25B054A0F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="13512-screen-shot-2017-03-10-at-33350-pm.png" alt="13512-screen-shot-2017-03-10-at-33350-pm.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is the full EL statement so you can copy it:&lt;/P&gt;&lt;PRE&gt;${file.lastModifiedTime:toDate("yyyy-MM-dd'T'HH:mm:ssZ"):toNumber():ge(${now():minus(86400000)})}&lt;/PRE&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 12:51:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151704#M56800</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2019-08-18T12:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to download files from sftp, with last modified time X hours.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151705#M56801</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/16489/kumarv0686.html" nodeid="16489"&gt;@vikash kumar&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Did you see the addition I made to my answer above that provided you with a working Expression Language statement to handle your routing?  If this solution addressed you question, please accept teh answer.&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 19:00:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151705#M56801</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2017-03-13T19:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to download files from sftp, with last modified time X hours.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151706#M56802</link>
      <description>&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;I'm trying to do the same flow, but I need to get the newest file from an FTP server.&lt;/P&gt;&lt;P&gt;I tried to set the time to 600000ms but the flow did not work.&lt;/P&gt;&lt;P&gt;${file.lastModifiedTime
:toDate("yyyy-MM-dd'T'HH:mm:ssZ")
:toNumber()
:ge(${now():minus(21600000)})
}&lt;/P&gt;&lt;P&gt;How can I get the newest file?&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Thais&lt;/P&gt;,&lt;P&gt;Hi Matt! I'm trying to do the same flow, but I need to get the newest file from an FTP.&lt;/P&gt;&lt;P&gt;Ho can I do that? &lt;/P&gt;&lt;P&gt;I tried to use 600000 (1 minute) but it did not work.&lt;/P&gt;&lt;P&gt;${file.lastModifiedTime
:toDate("yyyy-MM-dd'T'HH:mm:ssZ")
:toNumber()
:ge(${now():minus(6000000)})
}&lt;/P&gt;&lt;P&gt;Can you help?&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 19:09:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-download-files-from-sftp-with-last-modified-time-X/m-p/151706#M56802</guid>
      <dc:creator>thaishidaib</dc:creator>
      <dc:date>2017-05-10T19:09:48Z</dc:date>
    </item>
  </channel>
</rss>

