<available tag works>
Thanks Rich!
M-

----- Original Message ----- 
From: "Rich Wagner" <[EMAIL PROTECTED]>
To: "Ant Users List" <[email protected]>; <[EMAIL PROTECTED]>
Sent: Wednesday, February 15, 2006 11:14 AM
Subject: Re: test for directory existence


> These prompt for a (relative or absolute) path, and conditionally set a 
> property based on directory existence, and echo a message that reports 
> whether there's a directory at the given path:
> 
>    <target name="ask_for_path_and_echo_existence"
>            depends="exists,does_not_exist"/>
> 
>    <target name="ask_for_dir">
>        <input message="Enter path:" addproperty="PATH"/>
>        <property name="ABSOLUTE_PATH" location="${PATH}"/>
>        <available file="${ABSOLUTE_PATH}" type="dir"
>                   property="DIR.present"/>
>    </target>
> 
>    <target name="exists" depends="ask_for_dir" if="DIR.present">
>        <echo message="Directory exists:  ${ABSOLUTE_PATH}"/>
>    </target>
> 
>    <target name="does_not_exist" depends="ask_for_dir" 
> unless="DIR.present">
>        <echo message="Directory does NOT exist, or not a directory:  
> ${ABSOLUTE_PATH}"/>
>    </target>
> 
> 
> Hope this helps,
> Rich Wagner
> 
> 
> 
> Martin Gainty 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: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
>

Reply via email to