简体   繁体   English

用于在Java中将文件从本地计算机同步到远程服务器的命令 - WinSCP

[英]Command for syncing a file from local computer to a remote server in Java - WinSCP

I'm trying to automate a file synchronisation from a local computer to a remote host in java using WinSCP. 我正在尝试使用WinSCP自动化从本地计算机到Java中的远程主机的文件同步。 Can someone help me suggest what would be the command? 有人可以帮我建议命令是什么?

          //---Javacode
          Runtime.getRunTime().exe(cmd /...../);

Don't exec(). 不要exec()。 Use either the ant scp task which will do the same thing as WinSCP, or directly integrate JSCH: 使用与WinSCP执行相同操作的ant scp任务,或直接集成JSCH:

http://www.jcraft.com/jsch/ http://www.jcraft.com/jsch/

Much simpler. 更简单。

WinSCP command-line to synchronize file is like: 用于同步文件的WinSCP命令行如下:

winscp.com /command ^
    "option batch abort" ^
    "open sftp://username@example.com" ^
    "synchronize d:\www\ ./www/" ^
    "exit"

See the guide to WinSCP scripting . 请参阅WinSCP脚本编制指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Java将文件从本地计算机传输到WinSCP中的服务器 - Transferring file from local machine to server in WinSCP using Java 从本地Mac计算机向Linux服务器部署Java Web项目 - deploying a java web project from local mac computer to linux server Java:重命名从远程服务器下载的文件 - Java: Renaming a file downloaded from remote server 有什么方法可以从本地计算机(本地服务器)读取数据库文件并复制到 android 中的资产文件夹? - Is there any way that I can read database file from local computer (local server) and copy to assets folder in android? 使用Java将文件从FTP服务器下载到本地 - Download a file from FTP server to local in java REG-在Java中从本地计算机运行远程批处理文件 - REG - Run Remote batch file from local machine in java 使用Java IO将文件从本地复制到远程系统 - File Copy from local to remote system using java IO 使用Java将文件从本地文件夹复制到远程文件夹 - Copy file from local folder to remote folder using java 如何设置文件路径以通过Java Web应用程序将文件保存在本地计算机中 - How to set file path to save a file in my local computer from java web application 在Java程序中的远程计算机上运行批处理文件 - Run batch file on remote computer inside Java program
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM