Re: "Sync" sometimes does not delete folders

Dominique Devienne <[email protected]>
Newsgroups gmane.comp.jakarta.ant.user
Message-ID <CAFCRh-_eTn5bkUDf699jKsH3UpCGML92Fp5tkSa-Xa14_vS3eA@mail.gmail.com>
On Mon, Oct 17, 2016 at 12:51 PM, Al Le <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.