You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by etienne_frejaville <et...@coface.com> on 2005/08/16 19:04:03 UTC

Pb with copy and present selector

Hello,

I'm trying desperately to overwrite files from a source directory if they exist in a target directory.
The source and target directory have not the same hierarchy, source is flat and directory has sublevels.

Example of hierarchy:

root/source/A.html
root/source/B.html
root/source/C.html
...

root/dest/x/A.html
root/dest/y/B.html
root/dest/y/C.html
...


and I want that the names of the files to copy are obtained from dest and copied from source to dest, i.e :

root/source/A.html copied on root/dest/x/A.html
root/source/B.html copied on root/dest/y/B.html
root/source/C.html copied on root/dest/y/C.html
....

In shell, it's easily done like that:

cd root/dest
for i in */*.html
do
 cp ../source/`basename $i` $i
done

With ant, I've tried:

(launched from root directory) :

		<copy todir="dest" verbose="true">
			<fileset dir="source">
			   <present targetdir="dest">
                                <mapper type="regexp" from="(.*)\\(.*).html$$" to="\2.html"/>
                           </present>
			</fileset>
		</copy>

But it doesn't copy anything.
Actually, I'm quite puzzled with fileset and mappers.
 
Any idea? I've found very little literature on that subject.

As a corollary question, is there any tool that allows debugging such tasks, showing what is matched on each task .?

Thanks in advance.


**********************************************************************
Coface facilite les echanges entre les entreprises partout dans le monde. Pour cela, elle offre a toutes les entreprises des solutions pour gerer, financer et proteger leur poste client, en leur permettant d'externaliser tout ou partie de la gestion et des risques lies a leurs relations commerciales. Coface est notee AA par Fitch Ratings et Aa3 par Moody's.
Pour en savoir plus, http://www.coface.fr

Coface facilitates business-to-business commerce worldwide. It offers all size companies an array of solutions to manage, finance, and protect their accounts receivables affording them the option of fully or partly outsourcing trade relationship management and attendant risks. Coface is rated AA by Fitch ratings and Aa3 by Moody's.
More about Coface, http://www.coface.com

WARNING : 
- Soyez conscient que notre systeme Anti-Spam peut parfois rejeter des messages, soit parce que certains mots et types de fichiers ne sont pas acceptes, ou bien parce que le mail n'a pas ete identifie correctement.
- Be aware that from time to time our Anti-Spam system may reject mails either because some words and types of files are not allowed or because mails are misidentified. 
**********************************************************************


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