使用ANT从windows部署到unix(高效)
我想自动将文件从开发环境复制到 UNIX 服务器。
当使用ANT的SCP任务时,它如何处理同步目录?
我想确保:
- 不再在我的源中的文件将从目标服务器中删除
- 未更改的文件不应被复制(每次都需要永远完全同步每个 jar 文件)。
I want to automate copying files from a dev environment to a unix server.
When using ANT's SCP task, how does it handle synchronizing the directories?
I would like to ensure that:
- Files that are no longer in my source are removed from the destination server
- Files that didn't change should not be copied (it would take forever to fully sync every jar file every time).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
scp
是执行该任务的错误工具。尝试使用 rsync 代替。--delete
将删除不再位于源端的内容。未修改的文件不会被复制;事实上,rsync 只会复制现有文件中发生更改的部分(因此对于部分修改的文件(例如已附加的日志文件),速度更快)。scp
is the wrong tool for the task. Tryrsync
instead.--delete
will delete stuff that's no longer on the source side. Unmodified files are not copied; in fact,rsync
will only copy those parts of existing files that did change (so it's even faster for partially modified files like log files which have been appended to).