You can use the <available property="direxists" file="path to directory" 
type="dir"> to set a property based upon the existance of a directory...then 
create a target whose job is to delete the directory and use a if="direxists" 
attribute to control the whether the target really executes (or merely no-ops) 
based upon the property being set.
 
Good luck,
 
Ninju



----- Original Message ----
From: Martin Gainty <[EMAIL PROTECTED]>
To: Ant Users List <user@ant.apache.org>
Sent: Wednesday, February 15, 2006 9:38:45 AM
Subject: Re: test for directory existence


*Not sure about delete*
but I know
mkdir will fail if the folder is already in place
Thus the reason for checking the folder existence before mkdir operation

díky!
Martin-
----- Original Message ----- 
From: "Ondřej Světlík" <[EMAIL PROTECTED]>
To: "Ant Users List" <user@ant.apache.org>
Sent: Wednesday, February 15, 2006 10:31 AM
Subject: Re: test for directory existence


>> 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: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
> 
> Hello,
> 
> why do you want to check for it's existence? Both tasks (<delete> and
> <mkdir>) can handle non-existing respectively existing directories. See
> this example:
> 
> 
> <project name="delete" default="all">
> 
> <target name="all">
>        <mkdir dir="dir/dir2" />
>        <mkdir dir="dir/dir2" />
>        <delete dir="dir" />
>        <delete dir="dir" />
> </target>
> 
> </project>
> 
> It will successfully pass. The second <mkdir> won't do anything with the
> original content of the folder.
> 
> Best regards
> 
> Ondrej Svetlik
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

Reply via email to