On Mon, Oct 17, 2016 at 12:51 PM, Al Le <al...@gmx.de> wrote: > When synchronizing the dirs, we'd like to preserve some files. These files > have a certain local name. Hence we specify these files in the > 'preserveintarget' clause. > [...] What I observe is that the dir 'aaa' is not deleted because it > contains a file to preserve. But this file should be ignored in my case > because 'aaa' should be deleted as a whole. I.e. ant should not even look > into aaa. > How can I achieve this? >
You can't. <preserveintarget> "wins" indeed, by design, as the task is currently implemented. You'd need to add a (e.g.) "unlessAncestorDirIsRemoved" attribute on <preserveintarget> to "weaken" <preserveintarget>, with associated logic of course. Or you work around by copying/syncing your "preserved" files in to a 3rd directory. Sync as before, w/o the <preserveintarget> elements. And "restore" those back, provided their directory still exists. I think it's possible with a selector and mapper to figure out of the "preserved" files should be restored (not easy, but possible). FWIW. --DD