summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2002-12-05 02:37:23 (GMT)
committerSkip Montanaro <skip@pobox.com>2002-12-05 02:37:23 (GMT)
commit7dfb02d09a550908b3d70e2d5ab682d09d63c8d1 (patch)
tree1bd791796e7390298455beb8d66ba43ab8b3fe59 /Tools
parente07e18d41b5b5ac962c2e4c0dfaae79641452e1f (diff)
downloadcpython-7dfb02d09a550908b3d70e2d5ab682d09d63c8d1.zip
cpython-7dfb02d09a550908b3d70e2d5ab682d09d63c8d1.tar.gz
cpython-7dfb02d09a550908b3d70e2d5ab682d09d63c8d1.tar.bz2
allow optional port specified as part of the hostname, e.g.,
"www.zope.org:8021".
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/ftpmirror.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Tools/scripts/ftpmirror.py b/Tools/scripts/ftpmirror.py
index c3469d0..0886af6 100755
--- a/Tools/scripts/ftpmirror.py
+++ b/Tools/scripts/ftpmirror.py
@@ -4,7 +4,7 @@
usage: ftpmirror [-v] [-q] [-i] [-m] [-n] [-r] [-s pat]
[-l username [-p passwd [-a account]]]
- hostname [remotedir [localdir]]
+ hostname[:port] [remotedir [localdir]]
-v: verbose
-q: quiet
-i: interactive mode
@@ -13,7 +13,7 @@ usage: ftpmirror [-v] [-q] [-i] [-m] [-n] [-r] [-s pat]
-r: remove local files/directories no longer pertinent
-l username [-p passwd [-a account]]: login info (default .netrc or anonymous)
-s pat: skip files matching pattern
-hostname: remote host
+hostname: remote host w/ optional port separated by ':'
remotedir: remote directory (default initial)
localdir: local directory (default current)
"""
@@ -52,6 +52,9 @@ def main():
account = ''
if not args: usage('hostname missing')
host = args[0]
+ port = 0
+ if ':' in host:
+ host, port = host.split(':', 1)
try:
auth = netrc.netrc().authenticators(host)
if auth is not None:
@@ -79,7 +82,7 @@ def main():
#
f = ftplib.FTP()
if verbose: print 'Connecting to %s...' % `host`
- f.connect(host)
+ f.connect(host,port)
if not nologin:
if verbose:
print 'Logging in as %s...' % `login or 'anonymous'`