ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: Checking for file/directory existence
Date Sun, 12 Nov 2000 03:15:02 GMT
--- Artem Portnoy <artem_portnoy@ibi.com> wrote:
> Is it possible in Ant to execute a task depending on the file or
> directory existence?

There's the <available> task:
  http://jakarta.apache.org/ant/jakarta-ant/docs/#available
but I don't think you can specify a directory instead of a file.

But note: You can only do execution-determination with the if/unless at
the target level, not at the task level.

> For example, I would like to copy a certain file if it exists or skip
> the copy operation if it doesn't.  How do I do that?

Well, copy will tell you the file doesn't exist (post 1.2), but it won't
cause the build to fail just because of that. So it shouldn't actually
hurt anything if the <copy> executes even if the file doesn't exist.

Diane

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



__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/

Mime
View raw message