<?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: NiFi: Capture filename and filesize in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Capture-filename-and-filesize/m-p/138767#M48048</link>
    <description>&lt;P&gt;Thank you, that was it!  It would good if they get listed in the Attribute tab as well.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2016 01:09:43 GMT</pubDate>
    <dc:creator>ashsskum</dc:creator>
    <dc:date>2016-12-07T01:09:43Z</dc:date>
    <item>
      <title>NiFi: Capture filename and filesize</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Capture-filename-and-filesize/m-p/138764#M48045</link>
      <description>&lt;P&gt;How to capture the filesize and the filename, which can be found in the details section of the flowfile?  I understand that the filename is listed in the attribute section, but is there a way to know the variable name for filesize?&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/10088-kafka-flow-file.jpg"&gt;kafka-flow-file.jpg&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2016 12:45:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Capture-filename-and-filesize/m-p/138764#M48045</guid>
      <dc:creator>ashsskum</dc:creator>
      <dc:date>2016-12-06T12:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi: Capture filename and filesize</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Capture-filename-and-filesize/m-p/138765#M48046</link>
      <description>&lt;P&gt;I don't know of any out of box functionality to get file size.  You can use the execute script to and script up way to easily grab the file size.  Or build a processor to grab content size.  Here is what the code for the processor would look like.  very simple.&lt;/P&gt;&lt;PRE&gt;@Override
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
    final ComponentLog log = getLogger();
    final AtomicReference&amp;lt;String&amp;gt; value = new AtomicReference&amp;lt;&amp;gt;();

    FlowFile flowfile = session.get();

    session.read(flowfile, new InputStreamCallback() {
        @Override
        public void process(InputStream in) throws IOException {
            try{

                String outputHandler = context.getProperty(OUTPUTHANDLER).getValue();


                String stringToTest = IOUtils.toString(in);

                // Check length, in characters if that is what you want
                System.out.println(stringToTest.length()); // prints "11"

                // Or provided specific encoded sizes ie UTF-8. this can be property driven
                //String result = stringToTest.getBytes("UTF-8").toString();

                value.set(result);
            }catch(Exception ex){
                ex.printStackTrace();
&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Dec 2016 13:30:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Capture-filename-and-filesize/m-p/138765#M48046</guid>
      <dc:creator>sunile_manjee</dc:creator>
      <dc:date>2016-12-06T13:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi: Capture filename and filesize</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Capture-filename-and-filesize/m-p/138766#M48047</link>
      <description>&lt;P&gt;@kumar&lt;/P&gt;&lt;P&gt;The default FlowFile attributes include:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;entryDate

lineageStartDate

fileSize

filename

path

uuid
&lt;/PRE&gt;&lt;P&gt;The above FlowFile attribute key names are case sensitive.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2016 22:55:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Capture-filename-and-filesize/m-p/138766#M48047</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2016-12-06T22:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi: Capture filename and filesize</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Capture-filename-and-filesize/m-p/138767#M48048</link>
      <description>&lt;P&gt;Thank you, that was it!  It would good if they get listed in the Attribute tab as well.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 01:09:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Capture-filename-and-filesize/m-p/138767#M48048</guid>
      <dc:creator>ashsskum</dc:creator>
      <dc:date>2016-12-07T01:09:43Z</dc:date>
    </item>
  </channel>
</rss>

