ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan \"Rambius\" Ivanov" <rambiusparkisan...@yahoo.com>
Subject Re: test for directory existence
Date Wed, 15 Feb 2006 16:27:46 GMT
Hello,

<delete dir="..."/> and <mkdir dir="..."> tasks take
care of these details:

<project>
    <delete dir="i_do_not_exist"/>

    <mkdir dir="i_exist"/>
    <mkdir dir="i_exist"/>
</project>

Here, we are trying to delete a non-existing
directory. Of course, <delete> deletes nothing but it
executes successfully. Next, with the second
invokation of <mkdir> we want to create a directory
that already exists and <mkdir> creates nothing but it
executes successfully.

Regarding your original question, you can use
<available> task:
    <available file="i_do_not_exist" type="dir"
property="not.exists"/>
    <available file="i_exist" type="dir"
property="exists"/>
    <echo>$${exists} = ${exists}</echo>
    <echo>$${not_exists} = ${not_exists}</echo>

Next, you can use if and unless attributes of <target>
in order to control the build flow based on the
existence of the directories.

Regards
Ivan

--- Martin Gainty <mgainty@hotmail.com> wrote:

> Good Morning All-
> 
> How do you test for the existence of a folder before
> del or mkdir operation
> Has something to with <property ???
> 
> Thanks!
> 
> Martin Gainty
> 
> (mobile) 603-438-5053
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message