<?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: Escaping forward slash in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Escaping-forward-slash/m-p/405928#M252517</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/117603"&gt;@nifier&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I am not seeing the same behavior as you have reported which make me think your extracted.path is not not really 0 bytes.&lt;BR /&gt;&lt;BR /&gt;I suggest adding another dynamic property to your update Attribute processor to output the calculated length to verify.&lt;BR /&gt;&lt;BR /&gt;Here is what i see after my UpdateAttribute processor (newdir is set using your shared NiFi Expression Language (NEL) statement).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_0-1744375216155.png" style="width: 708px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44945i931AC2180F2DB70D/image-dimensions/708x689?v=v2" width="708" height="689" role="button" title="MattWho_0-1744375216155.png" alt="MattWho_0-1744375216155.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So I created&amp;nbsp; extracted.path with a single white space and then see what you describe, but that whitespace is a byte, so expected output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_1-1744375445639.png" style="width: 697px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44946i32878894B7B9D4B9/image-dimensions/697x671?v=v2" width="697" height="671" role="button" title="MattWho_1-1744375445639.png" alt="MattWho_1-1744375445639.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If it turns out your problem is because you have white space in the Extracted.path attribute, you could modify your NEL statement as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${extracted.path:trim():length():gt(0):ifElse(${extracted.path:append('/'):append(${filename})},${filename})}&lt;/LI-CODE&gt;&lt;P&gt;You use the trim() NEL function to remove leading or trialing whitespace from the extracted.path before calculating length.&amp;nbsp; This includes trimming of a line return.&lt;BR /&gt;&lt;BR /&gt;So in below you will see desired output even though extracted.path length is not 0 because I trimmed white space or line return.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_2-1744375977531.png" style="width: 695px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44947i3A1C775782B744C3/image-dimensions/695x667?v=v2" width="695" height="667" role="button" title="MattWho_2-1744375977531.png" alt="MattWho_2-1744375977531.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please help our community grow. If you found&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;any&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on&amp;nbsp;&lt;STRONG&gt;one or more&lt;/STRONG&gt;&amp;nbsp;of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Apr 2025 12:53:47 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2025-04-11T12:53:47Z</dc:date>
    <item>
      <title>Escaping forward slash</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Escaping-forward-slash/m-p/405633#M252494</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will like to append forward slash &lt;STRONG&gt;/&lt;/STRONG&gt; conditionally in EL. But not able to acheive it.&lt;/P&gt;&lt;P&gt;${extracted.path:length():gt(0):ifElse(${extracted.path:append('/'):append(${filename})},${filename})}&lt;/P&gt;&lt;P&gt;Have tried using ${literal('/')} as well but its not getting the value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2025 15:19:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Escaping-forward-slash/m-p/405633#M252494</guid>
      <dc:creator>nifier</dc:creator>
      <dc:date>2025-04-07T15:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping forward slash</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Escaping-forward-slash/m-p/405665#M252499</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/117603"&gt;@nifier&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The NiFi EL you are using is valid and works.&amp;nbsp; So this raise the question as to where you are trying to use it?&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;What version of Apache NiFi are you using?&lt;/LI&gt;&lt;LI&gt;Which NiFi processor are you using this in?&lt;/LI&gt;&lt;LI&gt;Which Processor property are you using it in?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;NOTE: Make sure the processor property supports NiFi EL.&amp;nbsp; You can't use EL in every property.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I validated your EL using the UpdateAttribute processor.&lt;BR /&gt;&lt;BR /&gt;I do have another question about your ifElse:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Why are you appending a filename to path?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;A more typical approach would be t simply use ${extracted.path}/${filename} in the processor that writes file out to destination.&amp;nbsp; If extracted.path is empty or does not exist it returns nothing.&lt;/P&gt;&lt;P&gt;Please help our community grow. If you found&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;any&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on&amp;nbsp;&lt;STRONG&gt;one or more&lt;/STRONG&gt;&amp;nbsp;of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 12:18:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Escaping-forward-slash/m-p/405665#M252499</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2025-04-08T12:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping forward slash</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Escaping-forward-slash/m-p/405887#M252512</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;What version of Apache NiFi are you using?&amp;nbsp;&lt;SPAN&gt;2.1.0&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;Which NiFi processor are you using this in?&amp;nbsp;&lt;SPAN&gt;UpdateAttribute&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;Which Processor property are you using it in? Added "&lt;SPAN&gt;extracted.path"&amp;nbsp;&lt;/SPAN&gt;Property&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Our use case is to retain the same nested folder structure as the source.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nifier_0-1744311075054.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44936i50E1CE0C996AE11F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nifier_0-1744311075054.png" alt="nifier_0-1744311075054.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AS you mentioned I did use "&lt;SPAN&gt;${extracted.path}/${filename}", however in case of "demo109.txt" the "extracted.path" is empty and gets created as "/${filename}" with forward slash at the begining.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To avoid this we wanted to set "/" conditionally.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Apr 2025 18:53:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Escaping-forward-slash/m-p/405887#M252512</guid>
      <dc:creator>nifier</dc:creator>
      <dc:date>2025-04-10T18:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping forward slash</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Escaping-forward-slash/m-p/405928#M252517</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/117603"&gt;@nifier&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I am not seeing the same behavior as you have reported which make me think your extracted.path is not not really 0 bytes.&lt;BR /&gt;&lt;BR /&gt;I suggest adding another dynamic property to your update Attribute processor to output the calculated length to verify.&lt;BR /&gt;&lt;BR /&gt;Here is what i see after my UpdateAttribute processor (newdir is set using your shared NiFi Expression Language (NEL) statement).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_0-1744375216155.png" style="width: 708px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44945i931AC2180F2DB70D/image-dimensions/708x689?v=v2" width="708" height="689" role="button" title="MattWho_0-1744375216155.png" alt="MattWho_0-1744375216155.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So I created&amp;nbsp; extracted.path with a single white space and then see what you describe, but that whitespace is a byte, so expected output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_1-1744375445639.png" style="width: 697px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44946i32878894B7B9D4B9/image-dimensions/697x671?v=v2" width="697" height="671" role="button" title="MattWho_1-1744375445639.png" alt="MattWho_1-1744375445639.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If it turns out your problem is because you have white space in the Extracted.path attribute, you could modify your NEL statement as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${extracted.path:trim():length():gt(0):ifElse(${extracted.path:append('/'):append(${filename})},${filename})}&lt;/LI-CODE&gt;&lt;P&gt;You use the trim() NEL function to remove leading or trialing whitespace from the extracted.path before calculating length.&amp;nbsp; This includes trimming of a line return.&lt;BR /&gt;&lt;BR /&gt;So in below you will see desired output even though extracted.path length is not 0 because I trimmed white space or line return.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_2-1744375977531.png" style="width: 695px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/44947i3A1C775782B744C3/image-dimensions/695x667?v=v2" width="695" height="667" role="button" title="MattWho_2-1744375977531.png" alt="MattWho_2-1744375977531.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please help our community grow. If you found&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;any&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on&amp;nbsp;&lt;STRONG&gt;one or more&lt;/STRONG&gt;&amp;nbsp;of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 12:53:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Escaping-forward-slash/m-p/405928#M252517</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2025-04-11T12:53:47Z</dc:date>
    </item>
  </channel>
</rss>

