<?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: Files in database are following Folder structure.But I am getting only Files. Is there any way to Fetch the Files with Folders, means it will store the data same as database(Folder inside folder inside file) in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196524#M76249</link>
    <description>&lt;P&gt;I am not getting what you explained can you please elaborate?&lt;BR /&gt;for database connection, I have used GETFTP processor.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Mar 2018 21:14:27 GMT</pubDate>
    <dc:creator>apatel750</dc:creator>
    <dc:date>2018-03-22T21:14:27Z</dc:date>
    <item>
      <title>Files in database are following Folder structure.But I am getting only Files. Is there any way to Fetch the Files with Folders, means it will store the data same as database(Folder inside folder inside file)</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196522#M76247</link>
      <description />
      <pubDate>Thu, 22 Mar 2018 18:51:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196522#M76247</guid>
      <dc:creator>apatel750</dc:creator>
      <dc:date>2018-03-22T18:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Files in database are following Folder structure.But I am getting only Files. Is there any way to Fetch the Files with Folders, means it will store the data same as database(Folder inside folder inside file)</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196523#M76248</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/47170/apatel750.html" nodeid="47170"&gt;@ANKIT PATEL&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Not sure what NiFi processors you may be using in your dataflow here, but take a look at the FlowFile attributes being created on the FlowFiles containing the files from your Database.   You could likely use one of those attributes to re-create the directory structure you are looking for when writing the files back out of NiFi.&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 19:27:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196523#M76248</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2018-03-22T19:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Files in database are following Folder structure.But I am getting only Files. Is there any way to Fetch the Files with Folders, means it will store the data same as database(Folder inside folder inside file)</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196524#M76249</link>
      <description>&lt;P&gt;I am not getting what you explained can you please elaborate?&lt;BR /&gt;for database connection, I have used GETFTP processor.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 21:14:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196524#M76249</guid>
      <dc:creator>apatel750</dc:creator>
      <dc:date>2018-03-22T21:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Files in database are following Folder structure.But I am getting only Files. Is there any way to Fetch the Files with Folders, means it will store the data same as database(Folder inside folder inside file)</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196525#M76250</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/47170/apatel750.html" nodeid="47170" target="_blank"&gt;@ANKIT PATEL&lt;/A&gt;&lt;/P&gt;&lt;P&gt;A NiFi FlowFile (this is what moves from processor to processor in NiFi) consists of two parts.  FlowFile content (Actual data) and FlowFile Attributes (Key/value metadata about the FLowFile).  Different processors that create FlowFile generate different attributes which are assigned to the FlowFile.  Attributes will contain some things like filename, fileSize, UUID, path, etc...&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;According to the documentation for the GetFTP processor the following FlowFile Attributes will be written on each FlowFile produced:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64762-screen-shot-2018-03-22-at-104745-am.png" style="width: 1738px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17920i0ED970695C0CDF65/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64762-screen-shot-2018-03-22-at-104745-am.png" alt="64762-screen-shot-2018-03-22-at-104745-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; -&lt;/P&gt;&lt;P&gt;The NiFi Expression Language (EL) can then be used to do things with these key/value pairs.  For example: setting a specific target directory to write a FlowFile's content.&lt;BR /&gt;-&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Assuming you are writing FlowFiles out of NiFi using say putFile:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64763-screen-shot-2018-03-22-at-105117-am.png" style="width: 475px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17921i49850387A5D180A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64763-screen-shot-2018-03-22-at-105117-am.png" alt="64763-screen-shot-2018-03-22-at-105117-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The above EL "${path}" will return the value from the flowfile attribute named "path" and use it as the target directory path to write the content.&lt;/P&gt;&lt;P&gt;You can even add to that path if you like:&lt;/P&gt;&lt;P&gt;for example:&lt;/P&gt;&lt;PRE&gt;/mynewdir/nifi/${path}&lt;/PRE&gt;&lt;P&gt;The above appends the value of path to the end of /mynewdir/nifi/...&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 06:27:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196525#M76250</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2019-08-18T06:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Files in database are following Folder structure.But I am getting only Files. Is there any way to Fetch the Files with Folders, means it will store the data same as database(Folder inside folder inside file)</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196526#M76251</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/47170/apatel750.html" nodeid="47170" target="_blank"&gt;@ANKIT PATEL&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here's a sample flow. For simplicity, instead of reding from FTP location, I am reading from local path.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64774-screen-shot-2018-03-23-at-10756-am.png" style="width: 796px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17915iBE9E62C4FC017987/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64774-screen-shot-2018-03-23-at-10756-am.png" alt="64774-screen-shot-2018-03-23-at-10756-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have 3 processors in my flow.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;ListFile - Will list the files in the directory I passed in the Configuration tab. Similar to ListFTP, just local.&lt;/LI&gt;&lt;LI&gt;FetchFile - Will fetch the files that I will mention. Again, similar to FetchFTP, but just local.&lt;/LI&gt;&lt;LI&gt;PutFile - Will write the data.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;If you pay attention, ListFile processor is giving me the list of the files in folder, and since the downstream processor is stopped, the flow files are queued up. So I went ahead and did a "List Queue" to see the flow files which are queued up. I saw something like this.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64775-screen-shot-2018-03-23-at-11342-am.png" style="width: 1336px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17916iD83D06A6F82D5913/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64775-screen-shot-2018-03-23-at-11342-am.png" alt="64775-screen-shot-2018-03-23-at-11342-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;These are called as "flow files" in NiFi. If you click the "&lt;EM&gt;i&lt;/EM&gt;" button to the leftmost side, you will see Attributes tab as shown below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64776-screen-shot-2018-03-23-at-11526-am.png" style="width: 608px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17917i60A895BBA7F8964A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64776-screen-shot-2018-03-23-at-11526-am.png" alt="64776-screen-shot-2018-03-23-at-11526-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64777-screen-shot-2018-03-23-at-125515-am.png" style="width: 762px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17918i463A9DD06F9B61AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64777-screen-shot-2018-03-23-at-125515-am.png" alt="64777-screen-shot-2018-03-23-at-125515-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can see many attributes, but the main attributes that we need in this example are &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;absolute.path - The location from where the file is&lt;/LI&gt;&lt;LI&gt;filename - The name of the file&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;These are the properties regarding the data we are about to fetch.&lt;/P&gt;&lt;P&gt;Now FetchFile can read these files from the given directory and I can tell my FetchFile processor to read these files by using these "attributes" as shown below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64778-screen-shot-2018-03-23-at-12019-am.png" style="width: 1398px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17919i09F26E0437299F91/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64778-screen-shot-2018-03-23-at-12019-am.png" alt="64778-screen-shot-2018-03-23-at-12019-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Since I have the directory name information available in the form an attribute, I can use it while storing the data as well and hence mimicking the exact directory structure from the source.&lt;/P&gt;&lt;P&gt;Hope that helps!&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 06:27:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196526#M76251</guid>
      <dc:creator>RahulSoni</dc:creator>
      <dc:date>2019-08-18T06:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Files in database are following Folder structure.But I am getting only Files. Is there any way to Fetch the Files with Folders, means it will store the data same as database(Folder inside folder inside file)</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196527#M76252</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/47170/apatel750.html" nodeid="47170"&gt;@ANKIT PATEL&lt;/A&gt;&lt;P&gt;Did the answer help in the resolution of your query? Please close the thread by marking the answer as Accepted!&lt;/P&gt;</description>
      <pubDate>Sun, 01 Apr 2018 23:23:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Files-in-database-are-following-Folder-structure-But-I-am/m-p/196527#M76252</guid>
      <dc:creator>RahulSoni</dc:creator>
      <dc:date>2018-04-01T23:23:04Z</dc:date>
    </item>
  </channel>
</rss>

