Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import pysftp
  2.  
  3. cnopts = pysftp.CnOpts()
  4. cnopts.hostkeys = None
  5.  
  6. srv = pysftp.Connection(host="localhost", username="username",password="password",cnopts=cnopts)
  7.  
  8. # Get the directory and file listing
  9. data = srv.listdir()
  10.  
  11. srv.put("input2.txt")
  12. srv.put("input3.csv")
  13. srv.put("input4.csv")
  14. srv.put("input5.csv")
  15. srv.put("input7.txt")
  16. srv.get("input8.csv")
  17.  
  18. # Closes the connection
  19. srv.close()
  20.  
  21. # Prints out the directories and files, line by line
  22. for i in data:
  23. print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement