There is no task for that, but a core function in Ant's FileUtils which can be 
used

<project>

    <scriptdef name="relpath" language="javascript">
        <attribute name="property"/>
        <attribute name="base"/>
        <attribute name="file"/>
        <![CDATA[
            importClass(Packages.org.apache.tools.ant.util.FileUtils);
            importClass(Packages.java.io.File);
            propName = attributes.get("property");
            baseFile = attributes.get("base");
            file     = attributes.get("file");
            relPath  = FileUtils.getRelativePath(new File(baseFile), new 
File(file) );
            project.setNewProperty(propName, relPath);
        ]]>
    </scriptdef>
    
    <target name="clean">
        <delete dir="x"/>
    </target>
    <target name="prepare">
        <mkdir dir="x/a/b/c/d/e/f/g"/>
        <echo file="x/a/b/c/d/e/f/g/file.txt" message="test"/>
    </target>
    <target name="test">
        <relpath property="rel" base="x/a/b" file="x/a/b/c/d/e/f/g/file.txt"/>
        <echo>
            File: x/a/b/c/d/e/f/g/file.txt
            Base: x/a/b
            rel : ${rel}
        </echo>
    </target>
</project>



Jan 

>-----Ursprüngliche Nachricht-----
>Von: Eric Dalquist [mailto:[EMAIL PROTECTED] 
>Gesendet: Montag, 17. September 2007 17:10
>An: user@ant.apache.org
>Betreff: fileset exclude with full path
>
>I have a full path to a directory that I want to create a 
>fileset of and 
>a full path to a sub-directory that I want to exclude.
>
>I've tried the following and some variations on it:
><fileset id="projectFiles" dir="/a/b/c/" excludes="/a/b/c/d/**" />
>
>No matter what I try I can't seem to get the excludes path to 
>be honored.
>
>I unfortunately do not have the ability to change the 
>sub-directory path 
>to a relative path instead of a full path, it is being populated from 
>another task that I do not have control over.
>
>Thank you,
>-Eric
>

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

Reply via email to