Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from ftplib import FTP
- import io
- import sys
- print("Please input the host address: ")
- ho = sys.stdin.readline(50).replace("\n", "")
- print("Please input the host port: ")
- po = sys.stdin.readline(6).replace("\n", "")
- print("Please input the username: ")
- us = sys.stdin.readline(50).replace("\n", "")
- print("Please input the password: ")
- pw = sys.stdin.readline(50).replace("\n", "")
- #https://docs.python.org/3/library/ftplib.html
- print("Connect to %s:%s@%s:%i" % (us, pw, ho, po))
- ftp = FTP() #Create FPT Object
- ftp.connect(ho, po) #Set the Host and Port
- ftp.login(us, pw) #Connect und login the user with the pw to the host and port
- ftp.dir() #Prints every given file and directory of the main folder
- ftp.quit() #Disconnect
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement