Update destination directory with new files (if modified) using ant -
i'm facing problem ant "copy". here requirement: want sync 2 dirs(dir1 , dir2) want keep files/dirs present in dir2. aim want copy dir1 contents(if modified ) dir2 want keep additional files/dirs present in dir2.
i tried ant's sync task, trying keep both dirs in sync ie., deleting contents present in dir2. don't find flag disable feature:
<sync todir="dir2" failonerror="true" verbose="true"> <fileset dir="dir1" excludes="*.svn" /> </sync>
i tried ant's copy "modified" selector, doing same: :(
<copy todir="dir2" failonerror="true"> <fileset dir="dir1" excludes="*.svn" > <modified/> <!-- copies modified files --> </fileset>
can 1 suggest, how can achieve requirement ant?
by default, ant copy task not overwrite files:
<copy todir="target/dir2" verbose="true" overwrite="false"> <fileset dir="src/dir1"/> </copy>
the copy task detect if file has changed.
the copy task not delete files, don't understand why second example (using modified selector) did not work.
Comments
Post a Comment