Created
October 22, 2020 14:00
-
-
Save tinshade/85dc495df7df0c659e5baffb42cacabb to your computer and use it in GitHub Desktop.
Creating a FTP server with Python3 and transferring files.
This file contains 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
#Start a server with: python -m pyftpdlib -p 21 -w --user="some_username" --password="some_password" | |
#Works for python3.x, didn't test for python2.x | |
import ftplib #Built-in library | |
session = ftplib.FTP('127.0.0.1', 'some_username' ,'some_password') | |
file = open('<filename with extension>','rb') # file to send | |
session.storbinary('STOR <recieved file name with extension>', file) # send the file | |
file.close() # close file and FTP | |
session.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment