I am trying to download each .txt file from my FTP server using python but as of now I only have one file being downloaded that is specified by it's name. Does anyone know the way I can change it to download all of the .txt files from my server?
# connect to the FTP server
ftp = FTP(FTP_HOST, FTP_USER, FTP_PASS)
ftp.encoding = "utf-8"
ftp.cwd('/files')
ftp.retrlines('LIST')
with open('test.txt', 'wb') as fp:
ftp.retrbinary('RETR test.txt', fp.write)
ftp.quit()