Is there a way to conditionally cooy a file using ant?

Posted by braveterry on Stack Overflow See other posts from Stack Overflow or by braveterry
Published on 2010-03-12T16:06:16Z Indexed on 2010/03/12 16:07 UTC
Read the original article Hit count: 198

Filed under:
|

I have the following target:

<target name="promptforchoice">

  <input addproperty="choice">
     Copy the file?.  [Y, n]
  </input>

    <condition property="copy.file">
        <or>
            <equals arg1="Y" arg2="${choice}"/>
            <equals arg1="y" arg2="${choice}"/>
        </or>
    </condition>

</target>

In another target, I'd like to conditionally copy a file depending on whether or not the copy.file property is set. Is this possible? Is there some other way to accomplish it?

© Stack Overflow or respective owner

Related posts about ant

Related posts about java