Skip to main content

How can I download file from ftpes:// to specified folder? I’m using the script below.

import fmeobjects
import os
from ftplib import FTP_TLS
import ssl

def processFeature(feature):
path = '/lsms/'
filename = 'apples.zip'

ftp = FTP_TLS('FTP-SERVER')
ftp.ssl_version = ssl.PROTOCOL_TLS
ftp.login('name', 'pass')
ftp.prot_p()
ftp.cwd(path)
ftp.retrbinary("RETR " + filename, open(filename, 'wb').write)
ftp.quit()
feature.setAttribute('name', filename)

 

Why not use the FTPCaller?


FTPCaller gives error with no clear info about it. I'm using older version of FME. Trying to work around this.


Reply