<?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: batch ftp in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825626#M87534</link>
    <description>Johan,&lt;BR /&gt;&lt;BR /&gt;Good, because I like Clay's answer. 10 = best answer, 9-8 = very very good, 7-5 = good, 4-1 = not exactly, 0 = way off base.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
    <pubDate>Mon, 14 Oct 2002 22:06:35 GMT</pubDate>
    <dc:creator>harry d brown jr</dc:creator>
    <dc:date>2002-10-14T22:06:35Z</dc:date>
    <item>
      <title>batch ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825619#M87527</link>
      <description>I know this question has been asked before but i didn't find it in the archives.  I'm working on setting up a scripted ftp session and I've tried the&lt;BR /&gt;&lt;BR /&gt;ftp &lt;SYSTEM&gt; &amp;lt;&amp;lt; EOF&lt;BR /&gt;user&lt;BR /&gt;password&lt;BR /&gt;ls&lt;BR /&gt;quit&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;and I've tried placing the commands in a file and using it as input to the session and in both cases it gets hung up on the password prompt.  &lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Johan&lt;/SYSTEM&gt;</description>
      <pubDate>Mon, 14 Oct 2002 19:35:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825619#M87527</guid>
      <dc:creator>Johan Nielsen</dc:creator>
      <dc:date>2002-10-14T19:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: batch ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825620#M87528</link>
      <description>I'll give you my standard answer:&lt;BR /&gt;&lt;BR /&gt;In the past, I used to do this stuff in the shell but now I NEVER do because I have found a much cleaner way to do it. You even get error trapping for free. Do this stuff in Perl using the Net::FTP module which is available from &lt;A href="http://www.cpan.org" target="_blank"&gt;http://www.cpan.org&lt;/A&gt; . &lt;BR /&gt;&lt;BR /&gt;Here's how simple it can be: &lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl -w &lt;BR /&gt;&lt;BR /&gt;use Net::FTP; &lt;BR /&gt;use strict; &lt;BR /&gt;&lt;BR /&gt;my $ftp = Net::FTP-&amp;gt;new("somehost",Debug =&amp;gt; 0); &lt;BR /&gt;$ftp-&amp;gt;login("cstephen","TopSecret"); &lt;BR /&gt;$ftp-&amp;gt;cwd("/tmp"); &lt;BR /&gt;$ftp-&amp;gt;get("myfile"); &lt;BR /&gt;my $stat = $ftp-&amp;gt;status; &lt;BR /&gt;my $full_stat = $ftp-&amp;gt;code; &lt;BR /&gt;# $stat contains the first digit; usually all &lt;BR /&gt;# that you need to do is test if it is equal &lt;BR /&gt;# to 2. $full_stat contains the full 3-digit &lt;BR /&gt;# value but is seldom needed &lt;BR /&gt;printf("Status: %d Full Status: %d\n",$stat,$full_stat); &lt;BR /&gt;# Sample Test &lt;BR /&gt;if ($stat == 2) &lt;BR /&gt;{ &lt;BR /&gt;print "Get was OK\n"; &lt;BR /&gt;} &lt;BR /&gt;else &lt;BR /&gt;{ &lt;BR /&gt;print "Get was BAD\n"; &lt;BR /&gt;} &lt;BR /&gt;$ftp-&amp;gt;quit; &lt;BR /&gt;&lt;BR /&gt;I think if you start using this module you will never go back to shell scripting FTP. Moreover, these same scripts will also run in the NT world. You can download a free version of perl for windows at &lt;A href="http://www.activeperl.com." target="_blank"&gt;http://www.activeperl.com.&lt;/A&gt; &lt;BR /&gt;Note that the answer is now the same on UNIX and NT. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Notice that this method easily handles the error checking. If you like, you can use the shell for most of your script and simply use a bit a perl for the actual FTP transfers. In that case add the statement exit($stat) to the perl script and then your shell script does have a valid status indication. You only need Perl on the FTP client end. &lt;BR /&gt;&lt;BR /&gt;It also becomes trivially easy to add looping to the code to retry the put/get a number of times if you get a staus of other than 2.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards, Clay &lt;BR /&gt;</description>
      <pubDate>Mon, 14 Oct 2002 19:43:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825620#M87528</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-10-14T19:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: batch ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825621#M87529</link>
      <description>Use the .netrc file to supply the user and password for ftp.&lt;BR /&gt;&lt;BR /&gt;you can supply a user and password for ech system to which you ftp. Once you get past the logon the rest of your script should work.&lt;BR /&gt;&lt;BR /&gt;the ./netrc file goes in your home directory.&lt;BR /&gt;&lt;BR /&gt;I use this to get patches from HP&lt;BR /&gt;machine ftp.itrc.hp.com login anonymous password me@my-company.com</description>
      <pubDate>Mon, 14 Oct 2002 19:45:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825621#M87529</guid>
      <dc:creator>Bill Costigan</dc:creator>
      <dc:date>2002-10-14T19:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: batch ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825622#M87530</link>
      <description>Try this .. create an executable file call "ftp-test" and in it put ..&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;{ echo "user username password&lt;BR /&gt;ls&lt;BR /&gt;quit" ; } ftp -i -n hostname&lt;BR /&gt;Put the appropriate "username", "password" and "hostname" in place and run it like so ..&lt;BR /&gt;$ ./ftp-test&lt;BR /&gt;Of course .. Clay's approach highly recommended.</description>
      <pubDate>Mon, 14 Oct 2002 19:55:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825622#M87530</guid>
      <dc:creator>S.K. Chan</dc:creator>
      <dc:date>2002-10-14T19:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: batch ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825623#M87531</link>
      <description>&lt;BR /&gt;Johan,&lt;BR /&gt;&lt;BR /&gt;What was wrong with Clay's answer? &lt;BR /&gt;&lt;BR /&gt;perl is really the best solution!&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 14 Oct 2002 20:16:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825623#M87531</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-10-14T20:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: batch ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825624#M87532</link>
      <description>Actually there was nothing wrong with the answer.  My understanding is that you rate the answer based on how well or quickly the problem is resolved.&lt;BR /&gt;&lt;BR /&gt;I believe that the perl solution is probably the best one but the quickest resolution came from utilizing .netrc file.&lt;BR /&gt;&lt;BR /&gt;I will adjust my rating accordingly in the future.&lt;BR /&gt;&lt;BR /&gt;Sorry Clay.&lt;BR /&gt;&lt;BR /&gt;johan</description>
      <pubDate>Mon, 14 Oct 2002 20:20:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825624#M87532</guid>
      <dc:creator>Johan Nielsen</dc:creator>
      <dc:date>2002-10-14T20:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: batch ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825625#M87533</link>
      <description>I know it's a bit late but the way to do without the .netrc file is as follows&lt;BR /&gt;&lt;BR /&gt;ftp -n &lt;SYSTEM&gt; &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;user password&lt;BR /&gt;..&lt;BR /&gt;..&lt;BR /&gt;quit&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;I agree the perl solution is better but sometimes shell is the quicker solution&lt;BR /&gt;&lt;BR /&gt;-ETL&lt;/SYSTEM&gt;</description>
      <pubDate>Mon, 14 Oct 2002 20:54:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825625#M87533</guid>
      <dc:creator>Evert Ladrak</dc:creator>
      <dc:date>2002-10-14T20:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: batch ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825626#M87534</link>
      <description>Johan,&lt;BR /&gt;&lt;BR /&gt;Good, because I like Clay's answer. 10 = best answer, 9-8 = very very good, 7-5 = good, 4-1 = not exactly, 0 = way off base.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 14 Oct 2002 22:06:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825626#M87534</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-10-14T22:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: batch ftp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825627#M87535</link>
      <description>I like a shell solution because I do most things in shell; perl is fine if you use perl often.  So something like this is very readable if you know ftp, and therefore easy to understand:&lt;BR /&gt;&lt;BR /&gt;#  ftp to NT server, get the backup report&lt;BR /&gt;#&lt;BR /&gt;(&lt;BR /&gt;  echo "open 192.1.1.67"&lt;BR /&gt;  echo "user anonymous root-corp"&lt;BR /&gt;  echo "ascii"&lt;BR /&gt;  echo "get checkfab.txt"&lt;BR /&gt;  echo "delete checkfab.txt"&lt;BR /&gt;  echo "bye"&lt;BR /&gt;) | ftp -i -n&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Oct 2002 11:14:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/batch-ftp/m-p/2825627#M87535</guid>
      <dc:creator>Fred Martin_1</dc:creator>
      <dc:date>2002-10-15T11:14:24Z</dc:date>
    </item>
  </channel>
</rss>

