ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pomè Elisabetta <ep...@axioma.it>
Subject R: copyng and renaming files
Date Wed, 29 Aug 2007 11:18:57 GMT
Thank you all,
I got some problem with your suggets

1) I tried to use ant-contrib with ant 1.7 but I got the error:
   java.lang.UnsupportedClassVersionError:
net/sf/antcontrib/property/PropertyCopy (Unsupported major.minor version
48.0)

2) I tried to use flattenmapper in different ways, but I couldn't be able to
let it work

Any ideas on how to go on?

Thank you

Elisabetta

-----Messaggio originale-----
Da: Vijay Aravamudhan [mailto:avijayr@gmail.com]
Inviato: mercoledì 29 agosto 2007 12.39
A: Ant Users List
Oggetto: Re: copyng and renaming files


you can achieve the same without using ant-contrib: by using a 
flattenmapper to get the list of files (without directory names), and 
then using that in an include to move from 'destination' to 
'destination/old' and then copying from 'origin' to 'destination'.

hth,
Vijay

Kriss wrote:
> Hi,
>
> 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/antcontrib.properties"/>
>
> <target name="main">
>  <for param="file2copy">
>    <path>
>      <fileset dir="${origine.dir}">
>      <include name="*.java"/>
>      </fileset>
>    </path>
>    <sequential>
>    <antcall target="backupAndCopy">
>     <param name="file2copy" value="@{file2copy}"/>
>    </antcall>
>    </sequential>
>  </for>
>     </target>
>
>
>     <target name="backupAndCopy">
>        <basename property="file2copy.filename" file="${file2copy}"/>
>  <move file="${dest.dir}/${file2copy.filename}" 
> tofile="${dest.backup.dir}/${file2copy.filename}"/>
>  <copy file="${origine.dir}/${file2copy.filename}" 
> tofile="${dest.dir}/${file2copy.filename}"/>
>     </target>
>
> </project>
>
>
> Have a nice day,
> kriss
>
> ----- Original Message ----- From: "Pomè Elisabetta" <epome@axioma.it>
> To: <user@ant.apache.org>
> 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 A.java e B.java) from a directoy 
Origin to a
>> directory Destination. The directory Destination already contains an 
>> older
>> version of A.java and B.java, but it contains many other 
files. Before
>> copying A.java and B.java (the new version) from Origin I 
need to save
>> A.java and B.java 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. www.axioma.it
>> via De Vizzi 35/39 - 20092 Cinisello B.mo (MI)
>> Tel. +39 02-618.061 - Fax +39 02-660.10337
>>
>>
>
>
> ---------------------------------------------------------------------
> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message