Select directories based on name and marker file in target directory

87 views Asked by At

I have a directory structure like shown below and a program that transforms files in an input directory to files in an output directory.

base directory
+ 001
  + input
  + output
+ 002
  + input
+ ...

Having many of these subdirectories, I am looking for a way to select those that have an input, but no output directory. What I adapted from https://ant.apache.org/manual/Types/dirset.html is the following:

<dirset dir="${project.path}">
    <include name="**/input"/>
    <present present="srconly" targetdir="${project.path}">
        <globmapper from="*/input" to="*/output/marker" />
    </present>
</dirset>

So I select the input directories based on their name and try to use present selector and globmapper to search for a marker file in the output directory. srconly should ensure that I select only those input directories for which there is no marker file in the output directory. Unfortunately, this does not work: I always get the set of all input directories back, despite the dirset page says it acts like an <and> selector container. Do you have any suggestions? Thanks a lot.

1

There are 1 answers

0
agoeb On BEST ANSWER

Apparently, the answer is that the "present" selector is case-sensitive. I was using a Windows server, and the value of ${project.path} was not cased correctly. Since most other operations on Windows are case-insensitive (including all other Ant features I used before), I did not run into any other problems.