ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <>
Subject Re: FIleset for files a user has permission to read
Date Thu, 22 May 2003 13:34:01 GMT
You need to use a custom selector to filter in the readable files.


 * Selector that filters readable files.
public class ReadableSelector extends BaseExtendSelector {
    public boolean isSelected(File basedir, String filename, File file) {
        return file.canRead();


and use:
<project name="t" default="t">
  <target name="t">
    <mkdir dir="classes"/>
    <javac srcdir="src" destdir="classes"/>
    <selector id="readable">
      <custom classname="ReadableSelector" 

    <touch file="notreadable"/>
    <chmod perm="ugo-r" file="notreadable"/>
    <fileset id="files" dir="." includes="*">
      <selector refid="readable"/>

    <pathconvert targetos="unix" property="files.string" refid="files"/>
    <echo message="${files.string}"/>


On Thursday 22 May 2003 13:41, wrote:
> I need to create a fileset for a tar task.  However there may be lock files
> in the directory tree that are not owned by the backup user.  these lock
> files are 600 permission and can not be tared up.  This causes ant to
> fail.what I want is a fileset of the files I have permission to read.  I
> spent some time looking though the docs but could not find it.  Any help
> would be appreciated.
> Mark Russell
> 412-768-9603
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message