||I'm trying to figure out how to retrieve a file from an FTP site using a wildcard. The file name always starts with the letters 'JAX' as in 'JAX_xxxx.tar.gz'. and I'm certain there is a way, using a wildcard, to download just that specific file. I've attached the code, line 22 is the line I can't figure out. It works this way, when I specify the entire file name, but I need to use a wildcard as the middle part of the file name, the date, changes from time to time.
Any suggestions would be greatly appreciated.
#python script by bob 5.17.06
#calls ftplib module & time module
#access qpublic ftp, download
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")
dir = 'Q:/Data/temp'
gp.Workspace = dir
fname = "Parcels_" + time.strftime("%m%d%y")
ftp = ftplib.FTP("www.data.com")
#Line that I can't figure out?
ftp.retrbinary('RETR JAX_may09.tar.gz', open(dir + "\\" + fname + "\\" + "JAX_may09.tar.gz", 'wb').write)