通过sftp上传文件夹和文件的工具。
shuft的Python项目详细描述
一种小型命令行工具,用于向SFTP服务器上传和下载文件和文件夹。 使用asyncsh,pip可安装,以便在自动化任务中使用。
- 将文件或文件夹上载到SFTP服务器。
- 需要Python3.5或更新版本。
开始
在您选择的虚拟python环境中,安装shuft pip包。
python pip install shuft
基本用法。
python shuft --command upload --host files.mydomain.com --localpath my_folder --remotepath /uploads/
使用“–help”运行以获取其他选项。
shuft --help usage: __main__.py [-h] --command {upload} --host HOST [--localpath LOCALPATH] [--remotepath REMOTEPATH] [--port PORT] [--known_hosts KNOWN_HOSTS] [--username USERNAME] [--password PASSWORD] [--client_keys CLIENT_KEYS] [--compress] Upload directories or files optional arguments: -h, --help show this help message and exit --command {upload} the task to perform. --host HOST the remote host to connect to. --localpath LOCALPATH path to the local folder or file. --remotepath REMOTEPATH path to the remote folder or file. --port PORT port number on the remote (defaults to 22). --known_hosts KNOWN_HOSTS list of known hosts, if set to None accepts any. --username USERNAME username for logging in on the remote, defaults to the current user --password PASSWORD password for logging in on the remote --client_keys CLIENT_KEYS list of client private key(s) --compress whether to compress target folder or file before transmission. Requires that the host accepts ssh connections and has tar available