Bug 21832 - sync task to ignore destination files
Summary: sync task to ignore destination files
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: nightly
Hardware: All All
: P3 enhancement with 3 votes (vote)
Target Milestone: 1.7.0
Assignee: Ant Notifications List
URL:
Keywords:
: 25749 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-07-23 17:18 UTC by Dave Brondsema
Modified: 2008-10-23 05:18 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Brondsema 2003-07-23 17:18:22 UTC
Using <fileset>, source files and directories can be excluded from the sync. 
However, it would be very useful to ignore files and directories from the
destination.

For example, I have a subdirectory 'xdocs' in my destination directory that has
lots of files in it and my source directory doesn't have 'xdocs'.  When I do a
<sync>, 'xdocs' is deleted.  I want to ignore 'xdocs' and just synchronize
everything else.
Comment 1 Stefan Bodewig 2004-06-04 12:30:09 UTC
*** Bug 25749 has been marked as a duplicate of this bug. ***
Comment 2 Stefan Bodewig 2005-03-14 09:26:48 UTC
It's in CVS HEAD (actually for some weeks now), "just" need to add docs.

The example would work as

<sync ...>
  <preserveintarget>
    <include name="xodcs/**"/>
  </preserveintarget>
</sync>
Comment 3 vamsihari 2008-10-22 23:46:48 UTC
Team , 

preserveintarget is not working,

still the sync job overwrites the folder/file in the target

this is how i'm using this target in my script

<sync todir="C:\test2" verbose="true">
          <fileset dir ="C:\test1"/>
	  <preserveintarget>
    	      <include name="donotcopy/**"/>
	 </preserveintarget>
</sync>

Comment 4 Stefan Bodewig 2008-10-23 05:18:22 UTC
preserveintarget ensures your files don't get deleted if they are not part of the source tree.  It doesn't have any influence on files that exist in the source tree (use an excludes in your source fileset for that).