Created
February 1, 2019 12:30
-
-
Save 7c00/187c5df0a60578090aa6fbf95df2119e to your computer and use it in GitHub Desktop.
You don't need an FTP client. Python provides one!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
import ftplib | |
import sys | |
ftp_server = sys.argv[1] | |
ftp_port = sys.argv[2] | |
filename = sys.argv[3] | |
session = ftplib.FTP() | |
session.connect(ftp_server, ftp_port) | |
session.login() | |
with open(filename, 'rb') as fd: | |
session.storbinary('STOR ' + filename, fd) | |
session.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment