At the moment I'm doing this:
目前我正在这样做:
<delete dir="${RSA.dir}/file1" />
<copy todir="${RSA.dir}/file1" >
<fileset dir="${CLEARCASE.dir}/file1" />
</copy>
and repeating the same thing for other files - but it takes a long time.
并为其他文件重复相同的事情 - 但这需要很长时间。
I only want to delete and copy files that have been updated, with their modified date in clearcase later than that in RSA.
我只想删除和复制已更新的文件,其修改日期晚于RSA中的明确日期。
How can I do that?
我怎样才能做到这一点?
2 个解决方案
#1
Look into the sync task.
查看同步任务。
If you want to do it based on file contents, and ignore the timestamp, I think this macro will do that:
如果你想根据文件内容来做,并忽略时间戳,我认为这个宏会这样做:
<macrodef name="mirror" description="Copy files only if different; remove files that do not exist in dir. This works similiar to robocopy /MIR." >
<attribute name="dir"/>
<attribute name="todir"/>
<sequential>
<copy overwrite="true" todir="@{todir}">
<fileset dir="@{dir}">
<different targetdir="${todir}"/>
</fileset>
</copy>
<delete includeemptydirs="true">
<fileset dir="@todir}">
<present targetdir="${dir}" present="srconly"/>
</fileset>
</delete>
</sequential>
</macrodef>
#2
You need to use a selector on a FileSet. Something like this:
您需要在FileSet上使用选择器。像这样的东西:
<fileset dir="${your.working.dir}/src/main" includes="**/*.java">
<different targetdir="${clean.clearcase.checkout}/src/main"
ignoreFileTimes="false"
ignoreContents="true" />
</fileset>
That compares your working dir to a clean checkout you have elsewhere, and returns the files whose last modified times have changed. You can use the fileset as the argument for a <delete>
or a <copy>
.
这会将您的工作目录与您在其他地方的清理结帐进行比较,并返回上次修改时间已更改的文件。您可以使用fileset作为
#1
Look into the sync task.
查看同步任务。
If you want to do it based on file contents, and ignore the timestamp, I think this macro will do that:
如果你想根据文件内容来做,并忽略时间戳,我认为这个宏会这样做:
<macrodef name="mirror" description="Copy files only if different; remove files that do not exist in dir. This works similiar to robocopy /MIR." >
<attribute name="dir"/>
<attribute name="todir"/>
<sequential>
<copy overwrite="true" todir="@{todir}">
<fileset dir="@{dir}">
<different targetdir="${todir}"/>
</fileset>
</copy>
<delete includeemptydirs="true">
<fileset dir="@todir}">
<present targetdir="${dir}" present="srconly"/>
</fileset>
</delete>
</sequential>
</macrodef>
#2
You need to use a selector on a FileSet. Something like this:
您需要在FileSet上使用选择器。像这样的东西:
<fileset dir="${your.working.dir}/src/main" includes="**/*.java">
<different targetdir="${clean.clearcase.checkout}/src/main"
ignoreFileTimes="false"
ignoreContents="true" />
</fileset>
That compares your working dir to a clean checkout you have elsewhere, and returns the files whose last modified times have changed. You can use the fileset as the argument for a <delete>
or a <copy>
.
这会将您的工作目录与您在其他地方的清理结帐进行比较,并返回上次修改时间已更改的文件。您可以使用fileset作为