You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Lloyd, Eric" <er...@lmco.com> on 2006/12/05 17:15:53 UTC

Using the '*' (wildcard)

Hi,
  I'm new to Apache ant, and I'm trying to get a very simple <exec> to
work. For some reason, wildcards ('*') work fine in some cases but not
in others. For example, the following works fine:
 
Note: In ./File/src/obj there is one file - File.o. And running "ls
./File/src/obj/*.o" from a terminal works.
 
<exec executable = "find">
    <arg line = './File/src/obj/ -name"*.o"' />
</exec>
 
This, however, doesn't:
 
<exec executable = "ls">
    <arg line = "./File/src/obj/*.o" />
</exec>
 
It gives me the error: ls: ./File/src/obj/*.o: No such File or
Directory.
 
It's like Ant isn't resolving the wildcard in the second case.
 
Can anyone tell me how to get the second example to work?
 
Also, I'm using version 1.6.5 on a red hat system.
 
Thanks!
Eric Lloyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Using the '*' (wildcard)

Posted by "Anderson, Rob (Global Trade)" <Ro...@nike.com>.
Normally, the shell would expand the wildcard when using ls. This is not
the case in Ant since ls is not being executed within a shell. Try using
a fileset and the <apply> task. Of course, you could also try executing
a shell, or shell script.

-Rob Anderson 

> -----Original Message-----
> From: Lloyd, Eric [mailto:eric.lloyd@lmco.com] 
> Sent: Tuesday, December 05, 2006 8:16 AM
> To: user@ant.apache.org
> Subject: Using the '*' (wildcard)
> 
> Hi,
>   I'm new to Apache ant, and I'm trying to get a very simple 
> <exec> to work. For some reason, wildcards ('*') work fine in 
> some cases but not in others. For example, the following works fine:
>  
> Note: In ./File/src/obj there is one file - File.o. And 
> running "ls ./File/src/obj/*.o" from a terminal works.
>  
> <exec executable = "find">
>     <arg line = './File/src/obj/ -name"*.o"' /> </exec>
>  
> This, however, doesn't:
>  
> <exec executable = "ls">
>     <arg line = "./File/src/obj/*.o" />
> </exec>
>  
> It gives me the error: ls: ./File/src/obj/*.o: No such File 
> or Directory.
>  
> It's like Ant isn't resolving the wildcard in the second case.
>  
> Can anyone tell me how to get the second example to work?
>  
> Also, I'm using version 1.6.5 on a red hat system.
>  
> Thanks!
> Eric Lloyd
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
> additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org