ython通过pysftp加密上传、下载ftp服务器文件

2021-11-02 13:37:58 浏览数 (1)

python通过pysftp加密上传、下载ftp服务器文件

代码语言:javascript复制
import pysftp
import sys
Defines the name of the file for download / upload
remote_file = sys.argv[1]
srv = pysftp.Connection(host="your_FTP_server", username="your_username",
password="your_password")
Download the file from the remote server
srv.get(remote_file)
To upload the file, simple replace get with put.
srv.put(remote_file)
Closes the connection
srv.close()</pre> 

0 人点赞