<?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>topic Re: script to move files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284264#M641476</link>
    <description>Sorry Dennis!&lt;BR /&gt;&lt;BR /&gt;I am lost:&lt;BR /&gt;&lt;BR /&gt;root@nrtrde2 # ls file_list&lt;BR /&gt;file_list&lt;BR /&gt;root@nrtrde2 # echo "scp -p $(&amp;lt; file_list)"&lt;BR /&gt;scp -p $(&amp;lt; file_list)&lt;BR /&gt;root@nrtrde2 # ps -fp $$&lt;BR /&gt;     UID   PID  PPID   C    STIME TTY         TIME CMD&lt;BR /&gt;    root 23099 23097   0 12:22:01 pts/1       0:00 -sh&lt;BR /&gt;root@nrtrde2 #&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;the echo just yields that&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;F.R.</description>
    <pubDate>Thu, 09 Jun 2011 08:20:09 GMT</pubDate>
    <dc:creator>NDO</dc:creator>
    <dc:date>2011-06-09T08:20:09Z</dc:date>
    <item>
      <title>script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284253#M641465</link>
      <description>Hi all&lt;BR /&gt;&lt;BR /&gt;I have a script that move files by month, but somehow it is not working, and returns the following error:&lt;BR /&gt;root@nrtrde2 # ./move.sh&lt;BR /&gt;&lt;BR /&gt;./move.sh: line 4: /usr/bin/scp: Arg list too long&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The script is :&lt;BR /&gt;find /global/xnode/mcel/tap_out -type f -exec ls -lrt {} \; |&lt;BR /&gt;  awk '{if ($6 == "Apr" &amp;amp;&amp;amp; $8 != 2010) print $9}' &amp;gt; file_list&lt;BR /&gt;&lt;BR /&gt;scp -p $(&amp;lt; file_list) root@10.100.48.11:/dcs/data02_loc/PROD/INPUT/TAPOUT/&lt;BR /&gt;&lt;BR /&gt;Can someone help&lt;BR /&gt;&lt;BR /&gt;F.R.</description>
      <pubDate>Wed, 08 Jun 2011 11:15:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284253#M641465</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2011-06-08T11:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284254#M641466</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;The culprit line is this:&lt;BR /&gt;&lt;BR /&gt;# scp -p $(&amp;lt; file_list) ...&lt;BR /&gt;&lt;BR /&gt;There are too many arguments (filenames) and/or the total length is too long.&lt;BR /&gt;&lt;BR /&gt;You may be forced to divide-and-conquer by either running several passes to collect files or by adding code to divide the whole file list into a series (maybe 3-10) of smaller subfiles that you then pass along to 'scp' from a 'for' loop.&lt;BR /&gt;&lt;BR /&gt;You can also gain performance by changing the ':' terminator of your 'find's '-exec' to a '+'.  This causes multiple arguments to be collected and passed to the pipeline, thereby dramatically reducing the number of 'awk' processes that are spawned.  Your users may appreciate this.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 08 Jun 2011 11:29:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284254#M641466</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-06-08T11:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284255#M641467</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;The issue is that I am running that find command to search for april files in 300 subdirectories.... then send them to another server...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;F.R.</description>
      <pubDate>Wed, 08 Jun 2011 11:33:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284255#M641467</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2011-06-08T11:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284256#M641468</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; The issue is that I am running that find command to search for april files in 300 subdirectories.... then send them to another server...&lt;BR /&gt;&lt;BR /&gt;That's not the issue.  The issue is that the *results* of the 'find' are too vast to form an argument list on the 'scp' command line.&lt;BR /&gt;&lt;BR /&gt;Divide-and-conquer as I said above.&lt;BR /&gt;&lt;BR /&gt;You could also break your 'find' into chunks by doing something like:&lt;BR /&gt;&lt;BR /&gt;# touch -mt 201104010000 /tmp/ref1&lt;BR /&gt;# touch -mt 201104152359 /tmp/ref2&lt;BR /&gt;# find find /global/xnode/mcel/tap_out -type f \( -newer /tmp/ref1 -a ! -newer /tmp/ref2 \) &amp;gt;&amp;gt; file_list &lt;BR /&gt;# scp ...&lt;BR /&gt;&lt;BR /&gt;Wrap this logic in a loop that varies the timestamps of the reference files created and walk through the timeframe you need.&lt;BR /&gt;&lt;BR /&gt;This also eliminates the majority of the forks you original code does!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 08 Jun 2011 11:56:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284256#M641468</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-06-08T11:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284257#M641469</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I have followed your advise and now I am getting issues on the "scp"&lt;BR /&gt;&lt;BR /&gt;I am having a syntax error.&lt;BR /&gt;can you share with me your knowledge, please.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;F.R.</description>
      <pubDate>Wed, 08 Jun 2011 14:24:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284257#M641469</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2011-06-08T14:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284258#M641470</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I have followed your advise and now I am getting issues on the "scp" I am having a syntax error.&lt;BR /&gt;&lt;BR /&gt;Post your script.  WIthout it and the actual error I can only guess ...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 08 Jun 2011 15:11:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284258#M641470</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-06-08T15:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284259#M641471</link>
      <description>HI (again):&lt;BR /&gt;&lt;BR /&gt;I meant to have written this block :&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;find /global/xnode/mcel/tap_out -type f \( -newer /tmp/ref1 -a ! -newer /tmp/ref2 \) &amp;gt; file_list&lt;BR /&gt;scp -p $(&amp;lt; file_list) ...&lt;BR /&gt;&lt;BR /&gt;That is, a redirection that overwrites the 'file_list' each time though the loop, not one that appends to the contents each time :-(&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 08 Jun 2011 15:16:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284259#M641471</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-06-08T15:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284260#M641472</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Sorry for the late reply:&lt;BR /&gt;&lt;BR /&gt;when I run: &lt;BR /&gt;scp -p $(&amp;lt; file_list) root@10.100.48.11:/dcs/data02_loc/PROD/INPUT/TAPOUT/&lt;BR /&gt;&lt;BR /&gt;I got the following error:&lt;BR /&gt;syntax error: `(' unexpected&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Fernando</description>
      <pubDate>Thu, 09 Jun 2011 05:07:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284260#M641472</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2011-06-09T05:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284261#M641473</link>
      <description>&amp;gt;I got the following error: syntax error: `(' unexpected&lt;BR /&gt;&lt;BR /&gt;Nothing obvious.  Perhaps you have a file with a "("?  Try:&lt;BR /&gt;echo scp -p $(&amp;lt; file_list) root@10.100.48.11:/dcs/data02_loc/PROD/INPUT/TAPOUT/&lt;BR /&gt;&lt;BR /&gt;Though if you aren't using a real shell, like the scummy C shell, you may get errors like this on the $() syntax.  Use `` instead.&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Jun 2011 06:46:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284261#M641473</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-06-09T06:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284262#M641474</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I did try that, see the o/p:&lt;BR /&gt;&lt;BR /&gt;root@nrtrde2 # echo scp -p $(&amp;lt; file_list)&lt;BR /&gt;syntax error: `(' unexpected&lt;BR /&gt;root@nrtrde2 # echo $SHELL&lt;BR /&gt;/sbin/sh&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And there is no special characters in file_list&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Fernando</description>
      <pubDate>Thu, 09 Jun 2011 06:52:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284262#M641474</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2011-06-09T06:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284263#M641475</link>
      <description># echo scp -p $(&amp;lt; file_list)&lt;BR /&gt;syntax error: `(' unexpected&lt;BR /&gt;&lt;BR /&gt;Then use quotes: echo "scp -p $(&amp;lt; file_list)"&lt;BR /&gt;&lt;BR /&gt;&amp;gt;# echo $SHELL&lt;BR /&gt;&lt;BR /&gt;This only works if you don't invoke a different shell.&lt;BR /&gt;Try: ps -fp $$</description>
      <pubDate>Thu, 09 Jun 2011 07:53:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284263#M641475</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-06-09T07:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284264#M641476</link>
      <description>Sorry Dennis!&lt;BR /&gt;&lt;BR /&gt;I am lost:&lt;BR /&gt;&lt;BR /&gt;root@nrtrde2 # ls file_list&lt;BR /&gt;file_list&lt;BR /&gt;root@nrtrde2 # echo "scp -p $(&amp;lt; file_list)"&lt;BR /&gt;scp -p $(&amp;lt; file_list)&lt;BR /&gt;root@nrtrde2 # ps -fp $$&lt;BR /&gt;     UID   PID  PPID   C    STIME TTY         TIME CMD&lt;BR /&gt;    root 23099 23097   0 12:22:01 pts/1       0:00 -sh&lt;BR /&gt;root@nrtrde2 #&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;the echo just yields that&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;F.R.</description>
      <pubDate>Thu, 09 Jun 2011 08:20:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284264#M641476</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2011-06-09T08:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284265#M641477</link>
      <description>What HP-UX version are you on?&lt;BR /&gt;After you type escape in your real shell, what version does control-V show?&lt;BR /&gt;&lt;BR /&gt;When I do that echo:&lt;BR /&gt;$ echo "scp -p $(&amp;lt; file_list)"&lt;BR /&gt;sh: file_list: Cannot find or open the file.&lt;BR /&gt;&lt;BR /&gt;(Because I don't have file.)&lt;BR /&gt;&lt;BR /&gt;About the only way that echo can produce that output is if the file "file_list" contains the string:&lt;BR /&gt;$(&amp;lt; file_list)</description>
      <pubDate>Thu, 09 Jun 2011 09:07:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284265#M641477</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-06-09T09:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284266#M641478</link>
      <description>Hi James &amp;amp; Dennis&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Its now working fine, what I did was to use as a second marker as file (/tmp/ref3) file with a much shorter period of time 201104052359.&lt;BR /&gt;&lt;BR /&gt;Files are now being sent to the other server, but I will have create several chunks of markers in order to send all the April files.&lt;BR /&gt;&lt;BR /&gt;Thank you for your help&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;Fernando</description>
      <pubDate>Thu, 09 Jun 2011 09:37:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284266#M641478</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2011-06-09T09:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284267#M641479</link>
      <description>&lt;P&gt;Hi (again) Fernando:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Thank you for your help&lt;BR /&gt;&lt;BR /&gt;If you are satisfied with the help that you received, please read the following about assigning points:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h30499.www3.hp.com/t5/help/faqpage/faq-category-id/kudos#kudos" target="_blank"&gt;http://h30499.www3.hp.com/t5/help/faqpage/faq-category-id/kudos#kudos&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF..&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2011 20:33:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284267#M641479</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-08-08T20:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284268#M641480</link>
      <description>Yes James, I always assign points to everybody, but just one more query.&lt;BR /&gt;&lt;BR /&gt;I did run the those comands on the prompt. If I put those on a script will it work?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Fernando</description>
      <pubDate>Thu, 09 Jun 2011 11:17:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284268#M641480</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2011-06-09T11:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284269#M641481</link>
      <description>Hi (again) Fernando:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I did run the those comands on the prompt. If I put those on a script will it work?&lt;BR /&gt;&lt;BR /&gt;Yes.  However, if you plan to run your script from a 'crontask' remember that 'cron' establishes a minimal environment.  In particular, any environmental variables that are in your 'profile's will be missing.  Plan ahead accordingly, of course.  See the manpages for 'crontab' for more information.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 09 Jun 2011 12:09:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284269#M641481</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-06-09T12:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: script to move files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284270#M641482</link>
      <description>Thank you all, I have already assign points.</description>
      <pubDate>Thu, 09 Jun 2011 12:31:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-move-files/m-p/5284270#M641482</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2011-06-09T12:31:46Z</dc:date>
    </item>
  </channel>
</rss>

