<?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: Trying to move files via ExecuteStreamCommand in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Trying-to-move-files-via-ExecuteStreamCommand/m-p/367712#M239966</link>
    <description>&lt;P&gt;hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/104397"&gt;@noncitizen&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;I have tested the following configuration on my local machine and it seems to be working fine. You can give it a try and let me know if it works:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Using GenerateFlowFile, I created a FlowFile having the attribute "&lt;SPAN&gt;absolute.path&lt;/SPAN&gt;" defined as "/home/test/testFolder/".&amp;nbsp; Now, you already have a flow which generates you all these information so you can skip this step.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In ExecuteStreamCommand, I have defined the following:&lt;BR /&gt;Command Path = bash&lt;BR /&gt;Command Arguments = -c;mv ${absolute.path:append('*.log')} ${absolute.path:append('logfiles')}&lt;BR /&gt;&lt;BR /&gt;The result is that all the files with the extension .log from within my folder /home/test/testFolder/ have been copied into /home/test/testFolder/logfiles.&lt;BR /&gt;I need to mention though the following:&lt;BR /&gt;- the absolute path should end with "/", otherwise, using your expression you will have something like&amp;nbsp;/path/input*.log.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Apr 2023 13:43:56 GMT</pubDate>
    <dc:creator>cotopaul</dc:creator>
    <dc:date>2023-04-04T13:43:56Z</dc:date>
    <item>
      <title>Trying to move files via ExecuteStreamCommand</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Trying-to-move-files-via-ExecuteStreamCommand/m-p/367607#M239954</link>
      <description>&lt;P&gt;First attempt:&lt;/P&gt;&lt;P&gt;Command Arguments = ${absolute.path:append('*.log')};${absolute.path:append('logfiles')}&lt;/P&gt;&lt;P&gt;Command Path = /bin/mv&lt;/P&gt;&lt;P&gt;No working directory set&lt;/P&gt;&lt;P&gt;Execution error = /bin/mv: cannot stat â/path/input/*.logâ: No such file or directory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I ran "/bin/mv /path/input/*.log /path/input/logfiles" from putty — no errors, files moved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second attempt:&lt;/P&gt;&lt;P&gt;Based on some online troubleshooting, e.g.,&amp;nbsp;&lt;A href="https://unix.stackexchange.com/questions/77007/mv-cannot-stat-no-such-file-or-directory-in-shell-script" target="_blank"&gt;https://unix.stackexchange.com/questions/77007/mv-cannot-stat-no-such-file-or-directory-in-shell-script&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Same as first, but first argument changed to "${absolute.path}"*.log&lt;/P&gt;&lt;P&gt;Execution error = same as above, except double quotes around first path&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Third attempt:&lt;/P&gt;&lt;P&gt;Command Arguments = *.log;logfiles&lt;/P&gt;&lt;P&gt;Command Path = /bin/mv&lt;/P&gt;&lt;P&gt;Working Directory = ${absolute.path}&lt;/P&gt;&lt;P&gt;Execution error = /bin/mv: cannot stat â*.logâ: No such file or directory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in putty, I cd into /path/input and type "/bin/mv *.log logfiles" — no errors, files moved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many folks online having the same/similar problem say "my bad, I had the wrong path" or "my bad, the files aren't there". No, for me, the path is right, and the files are there. Attribs on files/folders are 777.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using ExecuteStreamCommand all over the place with /bin/rm to delete files without any problem. This is the first time I'm trying to move files using /bin/mv.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At first, the special character was tripping me up, but then this (below) led me to believe it was not relevant to the problem, just a problem with Linux reporting the error using smart quotes and NiFi losing it in translation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/18081038/bad-character-showing-up-in-bash-script-execution" target="_blank"&gt;https://stackoverflow.com/questions/18081038/bad-character-showing-up-in-bash-script-execution&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It takes a lot for me to reach out for help, so I'm hoping I'm not missing something really obvious.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 15:22:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Trying-to-move-files-via-ExecuteStreamCommand/m-p/367607#M239954</guid>
      <dc:creator>noncitizen</dc:creator>
      <dc:date>2023-04-03T15:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to move files via ExecuteStreamCommand</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Trying-to-move-files-via-ExecuteStreamCommand/m-p/367658#M239962</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/104397"&gt;@noncitizen&lt;/a&gt;,&amp;nbsp;Welcome to our community! To help you get the best possible answer, I have tagged in our NiFi experts &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/103151"&gt;@cotopaul&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/31438"&gt;@TimothySpann&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;who may be able to assist you further.&lt;BR /&gt;&lt;BR /&gt;Please feel free to provide any additional information or details about your query, and we hope that you will find a satisfactory solution to your question.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 07:11:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Trying-to-move-files-via-ExecuteStreamCommand/m-p/367658#M239962</guid>
      <dc:creator>VidyaSargur</dc:creator>
      <dc:date>2023-04-04T07:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to move files via ExecuteStreamCommand</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Trying-to-move-files-via-ExecuteStreamCommand/m-p/367712#M239966</link>
      <description>&lt;P&gt;hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/104397"&gt;@noncitizen&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;I have tested the following configuration on my local machine and it seems to be working fine. You can give it a try and let me know if it works:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Using GenerateFlowFile, I created a FlowFile having the attribute "&lt;SPAN&gt;absolute.path&lt;/SPAN&gt;" defined as "/home/test/testFolder/".&amp;nbsp; Now, you already have a flow which generates you all these information so you can skip this step.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In ExecuteStreamCommand, I have defined the following:&lt;BR /&gt;Command Path = bash&lt;BR /&gt;Command Arguments = -c;mv ${absolute.path:append('*.log')} ${absolute.path:append('logfiles')}&lt;BR /&gt;&lt;BR /&gt;The result is that all the files with the extension .log from within my folder /home/test/testFolder/ have been copied into /home/test/testFolder/logfiles.&lt;BR /&gt;I need to mention though the following:&lt;BR /&gt;- the absolute path should end with "/", otherwise, using your expression you will have something like&amp;nbsp;/path/input*.log.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 13:43:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Trying-to-move-files-via-ExecuteStreamCommand/m-p/367712#M239966</guid>
      <dc:creator>cotopaul</dc:creator>
      <dc:date>2023-04-04T13:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to move files via ExecuteStreamCommand</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Trying-to-move-files-via-ExecuteStreamCommand/m-p/367714#M239967</link>
      <description>&lt;P&gt;Bingo! Thanks so much.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 13:57:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Trying-to-move-files-via-ExecuteStreamCommand/m-p/367714#M239967</guid>
      <dc:creator>noncitizen</dc:creator>
      <dc:date>2023-04-04T13:57:06Z</dc:date>
    </item>
  </channel>
</rss>

