获取ANT给scp只有新的/修改过的文件 [英] Getting ANT to scp only new/changed files

查看:170
本文介绍了获取ANT给scp只有新的/修改过的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的优化部署SCP目前的所有文件复制到只复制自上次生成后发生变更的文件。我相信这应该有可能与当前的设置莫名其妙,但我不知道如何做到这一点。

I would like to optimize my scp deployment which currently copies all files to only copy files that have changed since the last build. I believe it should be possible with the current setup somehow, but I don't know how to do this.

我有以下内容:

项目/ SRC /嗒嗒/嗒嗒/&下; ----文件我编辑(大多PHP在这种情况下,一些静态资产)

Project/src/blah/blah/ <---- files I am editing (mostly PHP in this case, some static assets)

工程/建造&LT; -------我有我使用的文件复制到这里本地生成步骤

Project/build <------- I have a local build step that I use to copy the files to here

我有一个SCP的任务,现在的副本所有项目/扩建到远程服务器,当我需要它。

I have an scp task right now that copies all of Project/build out to a remote server when I need it.

是否有可能以某种方式利用这个额外的构建目录的优势来完成我想要的东西 - 这意味着我只是想上传的src / **之间的差异,并建立/ **。是否有可能以某种方式获取本作中,ANT文件集,然后SCP的?

Is it possible to somehow take advantage of this extra "build" directory to accomplish what I want -- meaning I only want to upload the "diff" between src/** and build/**. Is it possible to somehow retrieve this as a fileset in ANT and then scp that?

我不明白它的意思是,如果我以某种方式文件中删除左右/乱糟糟的服务器上,Ant脚本不会注意到,但对我来说,这是好的。

I do realize that what it means is that if I somehow delete/mess around with files on the server in between, the ANT script would not notice, but for me this is okay.

推荐答案

您可以告诉蚂蚁SCP 只复制已自上次推使用修改过的文件修改标签,像这样:

You can tell ant scp to only copy files which have been modified since the last push using the modified tag like so:

<scp trust="true" sftp="true"... >
  <fileset dir="${local.dir}">
    <modified>
      <param name="cache.cachefile" value="localdev.cache"/>
    </modified>
  </fileset>
</scp>

您使用的第一次,它会在参数宣布,求CacheFile发送的所有文件和缓存时间戳。在此之后,它将只发送修改的。

The first time you use this, it will send all files and cache the timestamps in the cachefile declared in the param. After that, it will only send the modified ones.

测试和SFTP方式验证。

Tested and verified in sftp mode.

这篇关于获取ANT给scp只有新的/修改过的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆