Skip to content

Instantly share code, notes, and snippets.

@macloo
Last active December 16, 2015 14:08
Show Gist options
  • Save macloo/5446265 to your computer and use it in GitHub Desktop.
Save macloo/5446265 to your computer and use it in GitHub Desktop.
Python FTP script for uploading a single file
import ftplib
session = ftplib.FTP('HOSTNAME','USERNAME','PASSWORD')
session.cwd('//DIR//DIR//DIR//')
f = open('Downloads/picture.jpg', 'r')
session.storbinary('STOR pic2.jpg', f)
f.close()
session.quit()
# http://www.pythonforbeginners.com/code-snippets-source-code/how-to-use-ftp-in-python/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment