Excellent. Thank you. -- Tim Walker Senior Software Engineer [EMAIL PROTECTED] Freshwater Software 303-443-2266 ex. 6505 Looking for Answers to your SiteScope or SiteSeer questions? http://www.freshwater.com/support/search.htm
-----Original Message----- From: Erik Hatcher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 2:00 PM To: Ant Users List Subject: Re: Delete and File Properties A good solution is to use Ant 1.5's new selector capability. Unfortunately there is not a selector to filter out read-only files built-in. But the selector feature is extensible. I hope I'm not giving away the farm on our upcoming Ant book, but I was going to add this to Ant 1.6 anyway. Here is a custom selector to select only read-only files: package org.example.antbook; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.types.selectors.BaseExtendSelector; import java.io.File; public class ReadOnlySelector extends BaseExtendSelector { public boolean isSelected(File basedir, String filename, File file) throws BuildException { return (!file.canWrite()); } } Here's how I use it: <selector id="selector"> <custom classname="org.example.antbook.ReadOnlySelector" classpath="${build.dir}"/> </selector> <copy todir="${temp.dir}"> <fileset dir="${data.dir}"> <selector refid="selector"/> </fileset> </copy> If you wanted to invert the selection to choose only non-read-only files, simply wrap it with the <not> selector container. Erik ----- Original Message ----- From: "Tim Walker" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 12, 2002 3:45 PM Subject: Delete and File Properties > Hello, > > Unfortunately we have .class files checked in to the main project stream. Someday these will go away. My > problem now is that I'd like to be able to do a clean, but with respect for the file Read-Only property (i.e. > delete all class files except the read only ones). Currently, it looks like the Ant delete task doesn't care > and always deletes files matching the fileset criteria. > > Thanks, > > -- > Tim Walker > Senior Software Engineer > [EMAIL PROTECTED] > Freshwater Software > 303-443-2266 ex. 6505 > Looking for Answers to your SiteScope or SiteSeer questions? > http://www.freshwater.com/support/search.htm > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
