[Python-de] abgleich local mit remote ftp
Andreas Jung
andreas at andreas-jung.com
Mon Sep 2 19:24:11 EDT 2002
schau dir mal das programm sitecopy an.
-aj
----- Original Message -----
From: "Wolfgang Cohrs" <wcohrs at AWI-Bremerhaven.DE>
To: <python-de at python.net>
Sent: Monday, September 02, 2002 17:16
Subject: [Python-de] abgleich local mit remote ftp
> hallo,
> ich habe hier ein skript. was ich erweitern musss um eine locale
> directory mit einer remote abzugleichen.
> es sollen alle daten von remote via ftp abgeholt werden die local nicht
> vorhanden sind.
>
> ich habe aber leider von python keine ahnung. es waere nett wenn ihr
> mir helfen koenntet.
>
> danke
>
> wolfgang
>
>
> #!/tphs1/tphsoft/Python-1.5.2/bin/python
> import os
> import sys
> from ftplib import FTP
> ftphost=sys.argv[1]
> print "connecting to "+ftphost
> ftp = FTP(ftphost)
> ftp.login()
>
> ftp.cwd(sys.argv[2])
> l=ftp.nlst()
> print l
> for f in l:
> if f != "." and f != "..":
> cmd='RETR '+f
> print cmd
> try:
> ftp.retrbinary('RETR '+f, open(f, 'wb').write)
> except:
> print "Can not get: "+f
>
>
> --
> Wolfgang Cohrs
> Stiftung Alfred-Wegener-Institut fuer Polar- und Meeresforschung
> Postfach 120161 D 27515 Bremerhaven
> mailto:wcohrs at awi-bremerhaven.de
> http://www.awi-bremerhaven.de/People/show?wcohrs
>
>
>
>
> _______________________________________________
> Python-de maillist - Python-de at starship.python.net
> http://starship.python.net/mailman/listinfo/python-de
More information about the Python-de
mailing list