ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kriss" <>
Subject Re: copyng and renaming files
Date Wed, 29 Aug 2007 09:07:22 GMT

You can use antcrontib task 'for' and the task basename, as following :

<project name="backup and copy" default="main" basedir=".">
    <property environment="env"/>
    <property name="origine.dir" value="c:\origin"/>
 <property name="dest.dir" value="c:\dest"/>
 <property name="dest.backup.dir" value="c:\dest\old"/>

 <taskdef resource="net/sf/antcontrib/"/>

 <target name="main">
  <for param="file2copy">
      <fileset dir="${origine.dir}">
      <include name="*.java"/>
    <antcall target="backupAndCopy">
     <param name="file2copy" value="@{file2copy}"/>

     <target name="backupAndCopy">
        <basename property="file2copy.filename" file="${file2copy}"/>
  <move file="${dest.dir}/${file2copy.filename}" 
  <copy file="${origine.dir}/${file2copy.filename}" 


Have a nice day,

----- Original Message ----- 
From: "Pomè Elisabetta" <>
To: <>
Sent: Wednesday, August 29, 2007 10:53 AM
Subject: copyng and renaming files

> Hi everybody,
> I apologize if this issue have been posted previously, but I search the
> mailing list and I couldn't find nothing similar.
> I need to copy files (says e from a directoy Origin to a
> directory Destination. The directory Destination already contains an older
> version of and, but it contains many other files. Before
> copying and (the new version) from Origin I need to save
> and contained in Destination in another directory
> (Destination\Old). This is my problem: I don't know how to say to ant that
> the set of fils that it have to copy from Destination to Destinatio\Old is
> the same that in contained in Origin.
> Thank you in advance for your kind reply
> Elisabetta
> Axioma S.p.A.
> via De Vizzi 35/39 - 20092 Cinisello (MI)
> Tel. +39 02-618.061 - Fax +39 02-660.10337

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message