import pysftp srv = pysftp.Connection(host="your_FTP_server", username="your_username", password="your_password") # Get the directory and file listing data = srv.listdir() # Closes the connection srv.close() # Prints out the directories and files, line by line for i in data: print i #//python/8426