From owner-freebsd-questions@FreeBSD.ORG Thu Jan 28 22:41:41 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 787291065698 for ; Thu, 28 Jan 2010 22:41:41 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id 3BAE48FC1C for ; Thu, 28 Jan 2010 22:41:41 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id o0SMfebS035008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 28 Jan 2010 16:41:40 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.4/8.14.3) with ESMTP id o0SMfdFj048996 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 28 Jan 2010 16:41:40 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.4/8.14.3/Submit) id o0SMfdQq048990; Thu, 28 Jan 2010 16:41:39 -0600 (CST) (envelope-from dan) Date: Thu, 28 Jan 2010 16:41:38 -0600 From: Dan Nelson To: "Dixit, Viraj" Message-ID: <20100128224137.GZ50360@dan.emsphone.com> References: <9A8CAB63B4C2014B883AF16FDFB362FB01F016C5@xpo.staff.copa> <20100127225334.GX50360@dan.emsphone.com> <9A8CAB63B4C2014B883AF16FDFB362FB01F016CD@xpo.staff.copa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9A8CAB63B4C2014B883AF16FDFB362FB01F016CD@xpo.staff.copa> X-OS: FreeBSD 7.2-STABLE User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: clamav-milter 0.95.3 at email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Thu, 28 Jan 2010 16:41:40 -0600 (CST) X-Scanned-By: MIMEDefang 2.45 Cc: Polytropon , freebsd-questions@freebsd.org Subject: Re: Is their Automatic command to send a JPG file using FTP X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jan 2010 22:41:41 -0000 In the last episode (Jan 28), Dixit, Viraj said: > The script that I have setup does not work if I run the .netrc file. I > ran the commands in ftp -v mode and it did not like machine command, did > not like passwd or pwd etc. The commands in .netrc are not the same ones that you send on the ftp commandline (except for the macdef block), so that's to be expected. I just tried your sample netrc file (with changes to match my system) and it worked just fine: (dan@dan.19) /tmp> cat ~/.netrc machine 127.0.0.1 login dan password xxxxxx macdef init binary lcd /tmp cd / get COPYRIGHT quit (dan@dan.19) /tmp> ftp 127.0.0.1 Connected to 127.0.0.1. 220 studio FTP server (Version 6.00LS) ready. 331 Password required for dan. 230 User dan logged in. Remote system type is UNIX. Using binary mode to transfer files. binary 200 Type set to I. lcd /tmp Local directory now: /tmp cd / 250 CWD command successful. get COPYRIGHT local: COPYRIGHT remote: COPYRIGHT 229 Entering Extended Passive Mode (|||62084|) 150 Opening BINARY mode data connection for 'COPYRIGHT' (6191 bytes). 100% |*************************************| 6191 11.48 MB/s 00:00 ETA 226 Transfer complete. 6191 bytes received in 00:00 (6.32 MB/s) quit 221 Goodbye. (dan@dan.19) /tmp> ls -l /COPYRIGHT COPYRIGHT -r--r--r-- 1 root wheel 6191 Jan 13 11:14 /COPYRIGHT -rw-r--r-- 1 dan wheel 6191 Jan 13 11:14 COPYRIGHT If all you really want to do is download a single file from a remote server, you can give ftp a url-style commandline argument and it will log in and download the file automatically: http://www.freebsd.org/cgi/man.cgi?query=ftp#AUTO-FETCHING_FILES (dan@dan.19) /tmp> ftp ftp://dan:xxxxx@127.0.0.1/%2fCOPYRIGHT Connected to 127.0.0.1. 220 studio FTP server (Version 6.00LS) ready. 331 Password required for dan. 230 User dan logged in. Remote system type is UNIX. Using binary mode to transfer files. 200 Type set to I. local: COPYRIGHT remote: /COPYRIGHT 229 Entering Extended Passive Mode (|||57935|) 150 Opening BINARY mode data connection for '/COPYRIGHT' (6191 bytes). 100% |*************************************| 6191 4.42 MB/s 00:00 ETA 226 Transfer complete. 6191 bytes received in 00:00 (2.52 MB/s) 221 Goodbye. -- Dan Nelson dnelson@allantgroup.com