<?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: How to write a script to FTP in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647758#M880022</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt;See man ftp as you may have to set in in binary mode to get a claen ftp.&lt;BR /&gt;&lt;BR /&gt;Paula</description>
    <pubDate>Thu, 17 Jan 2002 20:53:53 GMT</pubDate>
    <dc:creator>Paula J Frazer-Campbell</dc:creator>
    <dc:date>2002-01-17T20:53:53Z</dc:date>
    <item>
      <title>How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647755#M880019</link>
      <description>I am working on HP-UX 9000/800 servers.&lt;BR /&gt;&lt;BR /&gt;How to write a script to FTP a file from &lt;BR /&gt;1&amp;gt; one server to another server in same network&lt;BR /&gt; and &lt;BR /&gt;2&amp;gt; To a NT desktop (different network).&lt;BR /&gt;Anybody can send a sample file for the script.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;&lt;BR /&gt;Narasimham&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jan 2002 20:48:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647755#M880019</guid>
      <dc:creator>Narasimham</dc:creator>
      <dc:date>2002-01-17T20:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647756#M880020</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;######################################  &lt;BR /&gt;# Send the files to the new server      &lt;BR /&gt;ftp -n 172.20.20.17 &amp;lt;&amp;lt; End_of_Ftp       &lt;BR /&gt;user &lt;LOGIN&gt; &lt;PASSWORD&gt;                 &lt;BR /&gt;prompt                                  &lt;BR /&gt;put &lt;FILE&gt;                               &lt;BR /&gt;bye                                     &lt;BR /&gt;End_of_Ftp &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Will do an automatic ftp&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Paula                             &lt;BR /&gt;&lt;/FILE&gt;&lt;/PASSWORD&gt;&lt;/LOGIN&gt;</description>
      <pubDate>Thu, 17 Jan 2002 20:52:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647756#M880020</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2002-01-17T20:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647757#M880021</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Here are two scripts: &lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh &lt;BR /&gt;ftp -n &amp;lt;&amp;lt; EOF &lt;BR /&gt;verbose &lt;BR /&gt;open thehost &lt;BR /&gt;user uuu ppp &lt;BR /&gt;get /tmp/stuff &lt;BR /&gt;close &lt;BR /&gt;EOF &lt;BR /&gt;&lt;BR /&gt;... &lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh &lt;BR /&gt;{ echo "open thehost &lt;BR /&gt;user uuu ppp &lt;BR /&gt;hash &lt;BR /&gt;mput * &lt;BR /&gt;close" &lt;BR /&gt;} | ftp -i -n -v 2&amp;gt;&amp;amp;1 | tee /tmp/ftplog.$$ &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 17 Jan 2002 20:53:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647757#M880021</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-01-17T20:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647758#M880022</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;See man ftp as you may have to set in in binary mode to get a claen ftp.&lt;BR /&gt;&lt;BR /&gt;Paula</description>
      <pubDate>Thu, 17 Jan 2002 20:53:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647758#M880022</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2002-01-17T20:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647759#M880023</link>
      <description>HI:&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 that makes error trapping duck soup. 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("remotehost",Debug =&amp;gt; 0); &lt;BR /&gt;$ftp-&amp;gt;login("cstephen","top_secret"); &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 good\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 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 and on the same subnet or across the net.&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. &lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Thu, 17 Jan 2002 20:55:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647759#M880023</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-01-17T20:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647760#M880024</link>
      <description>You can also use a tool called expect.  It is a tool for automating interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, etc.  It can create scripts for you using autoexpect.  You can find the package at &lt;A href="http://expect.nist.gov/." target="_blank"&gt;http://expect.nist.gov/.&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jan 2002 21:00:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647760#M880024</guid>
      <dc:creator>Cara Tock</dc:creator>
      <dc:date>2002-01-17T21:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647761#M880025</link>
      <description>Hi.. &lt;BR /&gt;i could do the FTP between unix machines using Paula's sample script.&lt;BR /&gt;&lt;BR /&gt;waiting for some sample script  for FTP from UNIX to NT desktop&lt;BR /&gt;&lt;BR /&gt;Thank you all&lt;BR /&gt;Narasimham&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jan 2002 21:13:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647761#M880025</guid>
      <dc:creator>Narasimham</dc:creator>
      <dc:date>2002-01-17T21:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647762#M880026</link>
      <description>Hi again:&lt;BR /&gt;&lt;BR /&gt;The scripts already offered should work for Unix to NT.  The key issue is transfer your text files in ASCII mode.  In this fashion, Unix "newlines" are automatically translated to Windows/DOS linefeed/carriage-return pairs, or vice versa in the opposite direction.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 17 Jan 2002 21:18:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647762#M880026</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-01-17T21:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647763#M880027</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;If you are going to transfer to a Windows box then you must have an FTP server service running on the NT side. This is not a standard product but there are packages available. However, if you turn the question around and let the Windows box serve as a client to transfer the file then all you need is the above Perl script. This way the same script works for both platforms.&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jan 2002 21:27:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647763#M880027</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-01-17T21:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647764#M880028</link>
      <description>I use this method to transfer files from Unix to NT.  Put a file called .netrc in the home directory of the user transfering files.  Then put the following in that file :&lt;BR /&gt;machine "machine name" login "user" password "password"&lt;BR /&gt;(/home/user/.netrc with r-------- rights only  chmod 400 .netrc)  &lt;BR /&gt;Then the followind script will work&lt;BR /&gt;ftp hqmediware &amp;lt;&amp;lt; EOF &lt;BR /&gt;put "file" &lt;BR /&gt;bye &lt;BR /&gt;EOF</description>
      <pubDate>Thu, 17 Jan 2002 21:44:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647764#M880028</guid>
      <dc:creator>Cara Tock</dc:creator>
      <dc:date>2002-01-17T21:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647765#M880029</link>
      <description>ftp "machine name" &amp;lt;&amp;lt; EOF &lt;BR /&gt;put "file" &lt;BR /&gt;bye &lt;BR /&gt;EOF</description>
      <pubDate>Thu, 17 Jan 2002 21:46:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647765#M880029</guid>
      <dc:creator>Cara Tock</dc:creator>
      <dc:date>2002-01-17T21:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647766#M880030</link>
      <description>Hi.. Damon Nirode  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;machine "machine name" login "user" password "password" &lt;BR /&gt;&lt;BR /&gt;is the above sholud be in .netrc in single line or multiple lines?&lt;BR /&gt;&lt;BR /&gt;with the above in one line i am getting a error : ftp: connect: Connection refused&lt;BR /&gt;&lt;BR /&gt;Narasimham</description>
      <pubDate>Thu, 17 Jan 2002 22:16:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647766#M880030</guid>
      <dc:creator>Narasimham</dc:creator>
      <dc:date>2002-01-17T22:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script to FTP</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647767#M880031</link>
      <description>It is on one line. If I have this &lt;BR /&gt;machine = NT1 (name in /etc/hosts or DNS or ..)&lt;BR /&gt;user = fred&lt;BR /&gt;password = 123456&lt;BR /&gt;Then I would put this in .netrc&lt;BR /&gt;machine NT1 login fred password 123456&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Jan 2002 22:11:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-a-script-to-ftp/m-p/2647767#M880031</guid>
      <dc:creator>Cara Tock</dc:creator>
      <dc:date>2002-01-22T22:11:22Z</dc:date>
    </item>
  </channel>
</rss>

