OT: ftp enhancement utility??

Bill Campbell bill at celestial.com
Thu Jul 1 16:54:27 PDT 2010


On Thu, Jul 01, 2010, John Esak wrote:
>ON SCO O/S 5.6  I used to use a little utility that let me use ftp with a
>config script something like:
>
>Ftpget fred.cfg
>
...
>I don't know what to google to find this utility. Does anyone know what it's
>called. Or, could it already be in the SCO 5.7 release?  I know it wasn't in
>5.6 and it was difficult or impossible to use FTP in this simple way with
>these little config files. 

I don't think I've ever used ftpget, but there are several
options to do this including wget, ncftp, and curl, all open
source and readily available.

I often use rsync for things like this as (a) it's much more
efficient than ftp when transferring files that have been
changed, and need to update an existing copy, (b) using the rsync
server and modules, it's easy to do secure transfers without
having to use ssh keys with empty pass phrases.

I also found that the python urllib makes transfers like this
pretty easy in python scripts.  I had used it many times to get
files with http URLs, but never had tried with ftp URLS, and it
Just Worked(tm).  A simple example:

#!/usr/bin/env python

import urllib

user = 'somebody'
pass = 'secret'
host = 'ftp.example.com'
url = 'ftp://%s:%s@%s' % (user, pass, host) # which is the same as:
url = 'ftp://somebody:secret@ftp.example.com'

(fname, header) = urllib.urlretrieve(url)

# fname now contains the file name of a temporary file containing
# the file transferred.  This must be copied or renamed before
# exiting the program as the temp file is removed automatically.
#
import os
os.rename(fname, '/tmp/myfile.data')

# header contains the HTTP headers returned by the call, and
# should probably be checked for abnormal results.

Bill
-- 
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186  Skype: jwccsllc (206) 855-5792

You know the one thing that's wrong with this country? Everyone gets a
chance to have their fair say.  -- Bill Clinton, May 29, 1993, The White House


More information about the Filepro-list mailing list