ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Oltmans" <joltm...@bolosystems.com>
Subject RE: Get copied fileset
Date Mon, 26 Feb 2007 21:09:32 GMT
I found a way around it, use pathconvert. This does turn the fileset or
direst into a property but that can still be used in an ant-contrib
foreach.
The real magic is in the <map> tag it remaps the names from the 'from'
location to the 'to' location. 

		<dirset id="directories"
                    dir="/dir/to/copy/from"
                    followsymlinks="false">
                <exclude name="**/.svn/**"/>
                <include name="**/*"/>
            </dirset>

            <pathconvert pathsep=";"
                         property="directories.list"
                         refid="directories">
                <map from="/dir/to/copy/from " to="/dir/to/copy/to "/>
            </pathconvert>

I hope that helps someone!
James

-----Original Message-----
From: Antoine Levy-Lambert [mailto:antoine@gmx.de] 
Sent: Friday, February 23, 2007 3:39 PM
To: Ant Users List
Subject: Re: Get copied fileset

Hello James,

there is no direct way to extract from the copy task these files.

what do you want to do once you have found the set of files which are
getting copied.

Some tasks work with filesets and mappers. 

Applying a mapper to the "new.files" fileset will give you what you
want.

Also have a look at the possibilities offered by resource collections in
ant 1.7. They contain a lot of nice stuff such as intersection ...

Regards,

Antoine


-------- Original-Nachricht --------
Datum: Fri, 23 Feb 2007 14:06:29 -0700
Von: "James Oltmans" <joltmans@bolosystems.com>
An: user@ant.apache.org
CC: 
Betreff: Get copied fileset

> Is there any way to create a fileset from the copy task that lists the
> files that were copied into the todir?
> 
>  
> 
> Here's the code snippet:
> 
>
------------------------------------------------------------------------
> ----------------------
> 
>             <fileset id="new.files"
> 
>                      dir="${tempdir}">
> 
>                 <exclude name="**/.svn/**"/>
> 
>                 <present present="srconly"
> 
>                          targetdir="${repos-files}"/>
> 
>             </fileset>
> 
>  
> 
>             <!--Copy new files into the repository's directory-->
> 
>             <copy todir="${repos-files}"
> 
>                   verbose="true"
> 
>                   includeEmptyDirs="true"
> 
>                   preservelastmodified="true">
> 
>                 <fileset refid="new.files"/>
> 
>             </copy>
> 
>
------------------------------------------------------------------------
> ----------------------
> 
> Is there any way I can get a list that has the new.files that were
> copied to repos-files with their full new path?
> 
> For example if I had two directories as follows and my fileset from
> above captured all the files in dir1 and copied them to dir2. 
> 
> Before copy:
> 
> /home/user/project/dir1/
> 
>             file1
> 
>             file2
> 
>             file3
> 
> /home/user/project/dir2/
> 
>             file4
> 
>             file5
> 
> After copy:
> 
> /home/user/project/dir1/
> 
>             file1
> 
>             file2
> 
>             file3
> 
> /home/user/project/dir2/
> 
>             file1
> 
>             file2
> 
>             file3
> 
>             file4
> 
>             file5
> 
> new.files would contain the following:
> 
> /home/user/project/dir1/file1
> 
> /home/user/project/dir1/file2
> 
> /home/user/project/dir1/file3
> 
>  
> 
> But I'd LIKE to get a new fileset that contains the following:
> 
> /home/user/project/dir2/file1
> 
> /home/user/project/dir2/file2
> 
> /home/user/project/dir2/file3
> 
>  
> 
> This would help because I could then perform other actions on the
copied
> files (specifically a svn add command) but I have no idea how to get
> this second fileset without using java. Is this something mappings
could
> help with?
> 
>  
> 
> James Oltmans
> Software Engineer
> Bolo Systems, Inc. 
> joltmans@bolosystems.com
> 
>  
> 
>  
> 

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



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


Mime
View raw message