ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Al Le" <>
Subject Re: "Sync" sometimes does not delete folders
Date Mon, 17 Oct 2016 10:51:09 GMT

I could track down the reason for the problem. Now I'd need an advice from experts how to
solve it :-)

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.

The problem is that if a directory that should be deleted as a whole (because it does not
exist in the source anymore) contains such a file, it does not get deleted (because it's still
not empty).

How could I achieve that the non-existence of the dir in the source "wins" over the 'preserveintarget'?

Here's an example:

source dir structure: empty (i.e. no files or subdirs in it)

target dir structure:

aaa (dir)
   fileToPreserve.txt (file)

<project default="sync">

    <property name="from" value="C:\testFrom" />
    <property name="to" value="C:\testTo" />

    <target name="sync">
        <sync todir="${to}">
            <fileset dir="${from}"/>
                <include name="**/fileToPreserve.txt" />


The desired result here would be that the dir 'aaa' is deleted in the target because the dir
does not exist in the source.

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?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message