from ftplib import FTP
from datetime import datetime
start = datetime.now()
ftp = FTP('your-ftp-domain-or-ip')
ftp.login('your-username','your-password')
# Get All Files
files = ftp.nlst()
# Print out the files
for file in files:
print("Downloading..." + file)
ftp.retrbinary("RETR " + file ,open("download/to/your/directory/" + file, 'wb').write)
ftp.close()
end = datetime.now()
diff = end - start
print('All files downloaded for ' + str(diff.seconds) + 's')`
Last active
May 6, 2024 09:45
-
-
Save nasrulhazim/cfd5f01e3b261b09d54f721cc1a7c50d to your computer and use it in GitHub Desktop.
Download Files From FTP Server using Python3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is the code for downloading all files, what if i want to download in selected date range?