You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David McTavish <dm...@SANDVINE.com> on 2003/01/02 21:51:17 UTC

copy fileset ignore non-existent directory

Is there anyway to provide a fileset to the copy command and ignore if the
specified source directory does NOT exist?

ie:

<copy todir="temp" failonerror="false">
    <fileset dir="nonexistent-dir" includes="some.files"/>
</copy>


The reason I need to do this is that sometimes when I call the target, the
directory does exist, and I want it to copy as normal, but if the directory
DOESN'T exist, I want it to ignore this.


thx,
d.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: copy fileset ignore non-existent directory

Posted by Antoine Levy-Lambert <le...@tiscali-dsl.de>.
David, maybe you would like to use the task available before doing your
copy.
here is an example which works :

<project name="test" default="test">
    <property name="from.dir" value="/toto"/>
    <target name="check">
        <available file="${from.dir}" property="from.dir.exists"
type="dir"/>
    </target>
    <target name="copy" depends="check" if="from.dir.exists">
        <copy todir="/temp">
             <fileset dir="${from.dir}" includes="**/*"/>
        </copy>
    </target>
    <target name="test" depends="copy"/>
</project>

Yours

Antoine Levy-Lambert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>