You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by rs...@chubb.com on 2001/09/10 19:28:22 UTC

using Available for presence of ANY files

I am looking to use <available/> to determine the presence/absence of ANY
files (i.e., one or more files) in a directory, as a condition of whether
to run a subsequent FTP target that would tranfer the files to a remote
server.  I tried using wildcards in the 'file' attribute:

<target name="myPropertiesPresent">
     <available property="myProperties.present" file="c:\properties\*.*">

</target>

<target name="ftpToServer" depends="myPropertiesPresent" if
="myProperties.present">
<ftp...</ftp>
</target>


But the log says:

myPropertiesPresent:
[available] Unable to find file c:\properties\*.* to set property
myProperties.present


Does anyone know a way of using <available/> to accomplish this? If not,
what other Ant task might accomplish the equivalent?

---------------------------------------
Ronald Signorino
rsignorino@chubb.com
Technical Analyst - Chubb Corporation
---------------------------------------



Re: using Available for presence of ANY files

Posted by Diane Holt <ho...@yahoo.com>.
Would the directory exist if there aren't any files in it? If not, you can
ask <available> to check for the directory itself existing, rather than
checking for any files in it. (If it would, I'll need to think about :)

Diane

--- rsignorino@chubb.com wrote:
> I am looking to use <available/> to determine the presence/absence of
> ANY
> files (i.e., one or more files) in a directory, as a condition of
> whether
> to run a subsequent FTP target that would tranfer the files to a remote
> server.  I tried using wildcards in the 'file' attribute:
> 
> <target name="myPropertiesPresent">
>      <available property="myProperties.present"
> file="c:\properties\*.*">
> 
> </target>
> 
> <target name="ftpToServer" depends="myPropertiesPresent" if
> ="myProperties.present">
> <ftp...</ftp>
> </target>
> 
> 
> But the log says:
> 
> myPropertiesPresent:
> [available] Unable to find file c:\properties\*.* to set property
> myProperties.present
> 
> 
> Does anyone know a way of using <available/> to accomplish this? If not,
> what other Ant task might accomplish the equivalent?
> 
> ---------------------------------------
> Ronald Signorino
> rsignorino@chubb.com
> Technical Analyst - Chubb Corporation
> ---------------------------------------
> 
> 


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com