This might be one of those forest-for-the-trees
situations... why would you use the find command in
Ant when one of Ant's oldest features is directory
scanning; i.e. finding files based on various
criteria?

-Matt

--- "Anderson, Rob (Global Trade)"
<[EMAIL PROTECTED]> wrote:

> Not in this case. The shell does not need to expand
> the asterisk for the
> find command to work. In fact, the shell can often
> times cause an error
> when running the find command because it expands the
> asterisk when it
> should not.
> 
> For example:
> 
> $ touch something.txt antherthing.txt yetanother.txt
> $ find ./ -name *.txt
> find: paths must precede expression
> Usage: find [path...] [expression]
> 
> This error occurs because the shell will expand the
> asterisk and pass in
> the three .txt files as args to find.
> 
> Now try this:
> 
> $ rm *.txt # be carefull to run this in some temp
> dir
> $ mkdir newdir
> $ touch newdir/something.txt newdir/anotherthing.txt
> newdir/yetanother.txt
> $ find ./ -name *.txt
> ./newdir/something.txt
> ./newdir/anotherthing.txt
> ./newdir/yetanother.txt
> 
> It works as expected because the shell does not
> expand the asterisk.
> 
> Anyway, I agree that you are better off doing this
> with a fileset in
> Ant, since it will be a cross platform solution.
> 
> -Rob A
> 
> 
> 
> > -----Original Message-----
> > From: Scot P. Floess
> [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, May 08, 2006 10:26 AM
> > To: Ant Users List
> > Subject: Re: Unix commads behaving different in
> Ant task
> > 
> > That won't work as a shell expands the
> asterisk....
> > 
> > Anderson, Rob (Global Trade) wrote:
> > > Your usage of the find command is incorrect. To
> find all 
> > the jars in 
> > > ./myDir you would run the following:
> > >
> > > Find ./myDir -name *.jar
> > >
> > > You should change the arg line to:
> > >
> > > <arg line="$basedir}/myDir -name *.jar"/>
> > >
> > > -Rob A
> > >
> > >   
> > >> -----Original Message-----
> > >> From: Venkat Kotu [mailto:[EMAIL PROTECTED]
> > >> Sent: Friday, May 05, 2006 11:42 AM
> > >> To: user@ant.apache.org
> > >> Subject: Unix commads behaving different in Ant
> task
> > >>
> > >> Hi,
> > >>
> > >>  
> > >>
> > >> I have a situation where in I need to find all
> the .jar 
> > files in  a 
> > >> directory and write it to a temp file.
> > >>
> > >>  
> > >>
> > >> The command from the prompt is : find
> myDir/*.jar and it lists all 
> > >> the .jar files from myDir directory.
> > >>
> > >>  
> > >>
> > >> The ant target defined for the purpose is:
> > >>
> > >>  
> > >>
> > >> <target name="list.jars">
> > >>
> > >>             <exec os="unix" executable="find" 
> > >> outputproperty="temp.txt">
> > >>
> > >>                         <arg
> line="$basedir}/myDir/*.jar"/>
> > >>
> > >>             </exec>
> > >>
> > >>  </target>
> > >>
> > >>  
> > >>
> > >> This does not return any thing.
> > >>
> > >>  
> > >>
> > >> What I am doing wrong?
> > >>
> > >>  
> > >>
> > >> Thanks
> > >>
> > >> Venkat Kotu
> > >>
> > >>  
> > >>
> > >>  
> > >>
> > >>
> > >>     
> > >
> > >
> > > 
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> [EMAIL PROTECTED] For 
> > additional 
> > > commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >   
> > 
> > --
> > Scot P. Floess
> > 27 Lake Royale
> > Louisburg, NC  27549
> > 
> > 252-478-8087 (Home)
> > 919-754-4592 (Work)
> > 
> > Chief Architect JPlate 
> http://sourceforge.net/projects/jplate
> > Chief Architect JavaPIM
> http://sourceforge.net/projects/javapim
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED] For 
> > additional commands, e-mail:
> [EMAIL PROTECTED]
> > 
> > 
> > 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to