ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shailesh Sharma <shailesh_s...@yahoo.com>
Subject RE: how to timestamp a copied file using ANT
Date Tue, 23 Mar 2004 17:28:53 GMT
Luis, I want exactly what you stated:
 
But i have a small problem here ...and the problem is that right now as you may see in my
task that iam hardcoding my filename type to be *.war .....but realistically i might NOT know
if this could be a jar file or a war file or an .ear file or a .rar file .....so i wanted
to make the "mapper" something like this:
 
<mapper type="glob" from="*.*" to="*.*.${DSTAMP}"/>

 
 
 
This is how my current target looks like:
 
 
<target name="copy-files">
    
    <tstamp/>
    <copy todir="../last-deployed-testnet">
           <fileset dir="../current-testnet"/>
           <mapper type="glob" from="*.war" to="*.war.${DSTAMP}"/>
    </copy>
</target>

 
 
any ideas .....thanks in advance !
 
-shailesh
 


"Conelly, Luis (GNF, Contractor)" <Luis.Conelly@gnf.com> wrote:
Shailesh,

As far as I understood, what you want to achieve is:

DirectoryA
|--> FileA.war
|--> FileB.war

Using ant, the expected output should be:

DirectoryB
|--> FileA.war.20040323
|--> FileB.war.20040323

Looking at the Ant Manual, on page[1] I found:



Copy a set of files to a directory, appending .bak to the file name on the fly








Based on this, and looking at the glob mapper[2], I came up with following snippet of code:










I suggest you to take a look around on these pages and see what you might use.

Regards
-Luis

PS. My config, in case you wonder:

OS: Win2K Pro 
JDK: 1.4.2_03
Ant: 1.6.1
---------------

[1] http://ant.apache.org/manual/CoreTasks/copy.html 
[2] http://ant.apache.org/manual/CoreTypes/mapper.html



-----Original Message-----
From: RADEMAKERS Tanguy [mailto:tanguy.rademakers@swift.com]
Sent: Tuesday, March 23, 2004 9:07 AM
To: Ant Users List
Subject: Re: how to timestamp a copied file using ANT


Shailesh,

Do you want to add a timestamp to the file names, or do you want to 
change the last modified property of the files?

/t

Shailesh Sharma wrote:

>Honestly - I have no clue what you are suggesting.
> 
>All i want is this:
> 
>I have 2 files (or more) in a folder called say "from" and when iam copying these 2 file
into a folder called say "to" ....i wanted to add timestamp to the copied files.
> 
>any simple and easy way in ANT ???
> 
>
>
>Rob van Oostrum wrote:
>you'll have to be more specific about what it is you want then ... 
>
>
>
>
>
>if you're talking about a collection of files you'll want to look at type="regexp" />
and map work the ${timestamp} into the to-mapping somehow
>....
>
> 
>
>>-----Original Message-----
>>From: Shailesh Sharma [mailto:shailesh_scea@yahoo.com]
>>Sent: Monday, March 22, 2004 4:39 PM
>>To: Ant Users List
>>Subject: RE: how to timestamp a copied file using ANT
>>
>>
>>I have looked at the but iam not been able to figure 
>>out ....how to use in my case.
>>
>>As iam doing a copy of all the files from a directory to 
>>another directory ....am confused in adding a TIMESTAMP.
>>
>>any ideas ?
>>
>>
>>Rob van Oostrum wrote:
>>look at and append the property value to the target filename ...
>>
>> 
>>
>>>-----Original Message-----
>>>From: Shailesh Sharma [mailto:shailesh_scea@yahoo.com]
>>>Sent: Monday, March 22, 2004 4:08 PM
>>>To: Ant Users List
>>>Subject: how to timestamp a copied file using ANT
>>>
>>>
>>>
>>>Hi,
>>>
>>>Iam copying a file from one directory to another after my 
>>>build is about to completed.
>>>
>>>
>>>
>>>
>>>
>>>----doing something here......
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>But apart from doing the copy, i also wanted to add a 
>>>timestamp to the copied file .............
>>>
>>>Does somebody know how to do this....Please advise.
>>>
>>>
>>>
>>>Thanks, shailesh
>>>
>>>
>>>Do you Yahoo!?
>>>Yahoo! Finance Tax Center - File online. File on time.
>>>
>>> 
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>For additional commands, e-mail: user-help@ant.apache.org
>>
>>Do you Yahoo!?
>>Yahoo! Finance Tax Center - File online. File on time.
>>
>> 
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>Do you Yahoo!?
>Yahoo! Finance Tax Center - File online. File on time.
> 
>

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

Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message