ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Qazwart <qazw...@gmail.com>
Subject Re: how to delete a file that matches a particular pattern?
Date Fri, 17 Aug 2007 00:59:35 GMT
Won't a fileset take care of this for you?

<delete>
     <fileset dir="${nokia.sdk.dir}">
         <include name="**/DBS_*#*-"/>
     <fileset/>
</delete>

Take a look at the manpage of the <delete> task: <http:// 
ant.apache.org/manual/CoreTasks/delete.html>  and see how they use a  
fileset in the examples.

Also take a look at the concept of a fileset: <http://ant.apache.org/ 
manual/CoreTypes/fileset.html> because filesets can be used to  
specify files in many different tasks.

If you are using exec tasks to execute a shell script or command, you  
may want to dig through the Ant manual and see if there is a way to  
use another Ant task. About 50% of the exec tasks found in most build  
scripts can probably be eliminated by simply using pure Ant features.  
That makes build scripts more flexible and less platform specific.

On Aug 16, 2007, at 7:18 PM, Erica A Ramsey wrote:

> Hello,
> I have a file that I want to periodically delete from system. I  
> don't know
> it's exact name but I do know it's parent directory and pattern for  
> it's
> name. The pattern for it's name is 'DBS_*#*-' and let's just say  
> that it's
> location is somewhere under "${nokia.sdk.dir}". how do I find and  
> delete all
> files matching this pattern? If I was using windows port of unix  
> find.exe I
> would do the following;
>    C:\project\>find
> C:/Nokia/Devices/S60_3rd_MIDP_SDK/bin/epoc32/winscw/c/private -type  
> f -name
> DBS_*#*- -exec rm -f {} ;
>
> however, my local environment has gnu32 unix port of find util on it
> clientes, which is where it will ulitimately run, does not, so  
> sticking that
> command in build.xml file will not work. I don't think any of  
> filters work
> with delete task. any ideas?
>
> Thanks
> ---
> JavaME (J2ME), Java, C & C# Developer
> CV: http://docs.google.com/Doc?id=dt6fqcn_51dn8gds
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>

David Weintraub
david@weintraub.name
qazwart@gmail.com



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


Mime
View raw message