Compare 2 directories and get the files missing in the other one with ant

Ant is an older  compile tool like maven or gradle.

In a project, there is an ant build.xml, which copies files from development into the testing-runtime.
But when there are renames in development, the testing-runtime still has the old files after running
the copy-task in the ant build.xml.

Ant has a task delete to remove files, but before using this one I have to know the fileset to remove!

The fileset task has a selector named different . This selector can compare directories and detect
the differences, which are available in the fileset.

This fileset can be deleted afterwards:

<fileset id="onlyTarget"  dir="${destinationDirectory}"  includes="${includesFiles}"  excludes="${excludeFiles}">    <different targetdir="${sourceDirectory}"    ignorefiletimes="true"    ignorecontents="true"  /></fileset> 
<echo message="Remove [${toString:onlyTarget}] from ${copyDest}" />
<delete> <fileset refid="onlyTarget" /></delete>

The includes and excludes narrow down the selection of files.