sync-my-code
一个同步本地和SFTP服务器文件的工具。
主要功能:
- 工具启动时,会同步本地工作目录和远程工作目录。
- 启动后,会实时监测本地工作目录的修改,并即时更新远程工作目录。
已经在Windows和MacOS上通过测试。
安装
npm install sync-my-code -g
使用说明
$ sync-my-code --help
Usage: sync-my-code [options]
一个同步本地和SFTP服务器文件的工具。
Options:
-V, --version output the version number
-w, --work-path [value] 需要同步的本地工作路径
-c, --create-syncrc-path [value] 在指定目录创建一个.syncrc.json
-h, --help output usage information
运行程序目前有两个可选参数-w
和-c
:
-w
指定需要同步的本地工作路径。要求本地工作路径下有.syncrc.json
配置文件。-c
指定一个需要生成配置文件的工作目录。程序会在生成.syncrc.json
配置文件后自动退出。
配置文件是一个JSON文件:
配置文件说明:
配置项 | 数据类型 | 说明 |
---|---|---|
remote_host | String | 远程SFTP服务器的域名或IP |
remote_port | Number | 远程SFTP服务器的端口号 |
remote_username | String | 远程SFTP服务器的用户名 |
remote_password | String | 远程SFTP服务器的密码 |
remote_path | String | 远程SFTP服务器的同步工作路径 |
ignore_file | Array | 在同步文件中需要过滤的列表 |
ignore_dir | Array | 在同步文件夹中需要过滤的列表 |
ignore_watch | String | 在实时监测文件变化中,需要匹配的正则表达式。注1 |
注1:当文件名能够匹配正则表达式时,这个文件会被忽略,这个配置,主要用来过滤一些临时文件。