.gz とファイル名 (xxxxxxxxxxxx_PARSERxxxxx.tar.gz) の拡張子を持つパッケージを、1.1.1.1 (変数としての入力である必要があります) というリモート ディレクトリに配置しました。現在、2.2 というマシンからスクリプトを実行しています。 2.2、パッケージをマシン 3.3.3.3 (変数として入力する必要があります) に配置する必要があり、同じスクリプトを準備しましたが、機能しません。
これまでにスクリプト化したコードは次のとおりです(動作していません):
#!/usr/bin/python 
#ftp.py 
import sys 
import telnetlib 
from ftplib import FTP 
import os 
def handleDownload(block): 
    file.write(block) 
    print ".", 
hstip= raw_input('Enter the hstip: ')      #ip of the machine where packages ae placed
uid = raw_input('Enter the username: ')   #uid os the machine whr packages are placed
pwd = raw_input('Enter the user password: ') #pwd of hte machine where packages are palced
path = raw_input('Enter the path where packages are present: ') #path for the packages.
rmthstip= raw_input('Enter the hstip: ')      #ip of the machine where packages to be placed
rmtuid = raw_input('Enter the username: ')   #uid os the machine whr packages to be placed
rmtpwd = raw_input('Enter the user password: ') #pwd of hte machine where packages to be palced
cwd = os.getcwd() 
os.chdir(cwd) 
logout = 'parser files downloaded succesfully' 
tn = telnetlib.Telnet(rmtip) 
tn.read_until("login: ") 
tn.write(rmtuid + "\n") 
tn.read_until("Password:") 
tn.write(rmtpwd + "\n") 
ftp=FTP(hstip,uid,pwd) 
print 'Logging in.' 
ftp.login(uid,pwd) 
ftp.cwd(path) 
parserfile = 'find . -name "*PARSER*.gz"' 
filenm = os.system(parserfile) 
print filenm 
ftp.retrbinary(' RETR ', 'filenm', logout ) 
ftp.quit() 
tn.close()