ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: Check to See If Directory Exists
Date Wed, 11 Oct 2006 12:27:44 GMT
Ok, not everyone does have a look into the source ;-) public class Mkdir extends Task {   :    ...    public void execute() throws BuildException {   :        ...        if (!dir.exists()) {            boolean result = mkdirs(dir);

I'll put a not into the manual (revision 462786).


>-----Urspr√ľngliche Nachricht-----
>Von: Robert Pepersack [] 
>Gesendet: Mittwoch, 11. Oktober 2006 14:07
>Betreff: Re: Check to See If Directory Exists
>OK.  I looked in the online documentation and read from the 
>book "Java Development With Ant", but neither documented this 
>behavior of <mkdir>.
>Thanks for your help,
>Robert Pepersack
>Senior Lead Developer
>Maryland Insurance Administration
>>>> 10/10/2006 4:29 PM >>>
>> I need to check to see if a directory exists, and if not, then
>> the directory.  But, if the directory already exists, then leave it 
>> alone, because it may already contain some important files.  I have
>> than a dozen directories to check for, and I would like to find a way
>> do this that's less verbose than a bunch of <property> and
>> tasks.  Does anyone know how?
>> Here's the equivalent command from a batch file:
>> if not exist c:\myapp mkdir c:\myapp
>Well, since <mkdir> is a no-op for an existing directory, you 
>don't even need to use <available>. And to process several 
>dirs, either manually write all the <mkdir>s, or select the 
>dirs in a <fileset> or <path>, and loop over it using 
>Ant-Contrib's <for> task. --DD
>To unsubscribe, e-mail: For 
>additional commands, e-mail: 
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message