ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srikrishna.Par...@wellsfargo.com
Subject RE: Requirement to copy from local drive to network drive
Date Thu, 13 May 2004 20:59:43 GMT
I have the following in build.properties 

location.target=\\eaireel\wls70\staging-2004-0513
param.mail.dist.dir=c:/temp

<project name="copyFile" default="copyFile" basedir=".">
<property file="build.properties"/>
<target name="copyFile">
<timestamp/>    
<copy todir="${location.target}" >
          <fileset dir="${param.mail.dist.dir}">
              <include name="*.zip"/>
          </fileset> 
          <mapper type="glob" from="*" to="${DSTAMP}-*"/>
        </copy>
         
    </target>
</project>

I tried your suggestion . It is not working. Can you please help



-----Original Message-----
From: Conelly, Luis (GNF, Contractor) [mailto:Luis.Conelly@gnf.com] 
Sent: Thursday, May 13, 2004 11:34 AM
To: user@ant.apache.org
Subject: RE: Requirement to copy from local drive to network drive 

As mentioned in [1]

<snippet>

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

  <copy todir="../backup/dir">
    <fileset dir="src_dir"/>
    <mapper type="glob" from="*" to="*.bak"/>
  </copy>


</snippet>

Instead, <mapper type="glob" from="*" to="${DSTAMP}-*"/> will append the
current date prior to the names of all files when copied; therefore, if you
have:

a.txt
b.txt
c.txt

and you copy them using glob mapper, you will get:

YYYYMMDD-a.txt
YYYYMMDD-b.txt
YYYYMMDD-c.txt

where 'YYYYMMDD' is the current date. Obviously, you will have to use
<tstamp> task somewhere prior to execute the task, in order let ant replace
${DSTAMP} with the current date. You can have more info about mappers at [2]

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

HTH
Luis

-----Original Message-----
From: Srikrishna.Partha@wellsfargo.com
[mailto:Srikrishna.Partha@wellsfargo.com]
Sent: Thursday, May 13, 2004 12:36 PM
To: Conelly, Luis (GNF, Contractor)
Subject: RE: Requirement to copy from local drive to network drive 


Can you explain what this statement does ?

<mapper type="glob" from="*" to="${DSTAMP}-*"/>

Thanks in advance

-----Original Message-----
From: Conelly, Luis (GNF, Contractor) [mailto:Luis.Conelly@gnf.com] 
Sent: Wednesday, May 12, 2004 7:37 AM
To: Ant Users List
Subject: RE: Requirement to copy from local drive to network drive 

I have achieved what you want with:

    <target name="copyFile">
        <copy todir="${location.target}" >
          <fileset dir="${param.mail.dist.dir}">
              <include name="**/*.zip"/>
              <include name="**/*.jar"/>
          </fileset>
          <mapper type="glob" from="*" to="${DSTAMP}-*"/>
        </copy>
    </target>

where 
${location.target} is defined as an UNC path
[\\server\sharedresource\directory]
If you define it in a properties file (as I do) you should escape the
backslashes, in order to be well-interpretated by java.util.Properties
class; otherwise, you can define it as is.

This has the advantage that works for Win and for *nix, since the path is
not hardcoded at all and can be defined for your favorite OS.

HTH
Regards
Luis

-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
Sent: Wednesday, May 12, 2004 1:03 AM
To: user@ant.apache.org
Subject: RE: Requirement to copy from local drive to network drive 


> I have a zip file . I would like to copy from my local drive 
> to my network
> drive . Can we accomplish this in Ant 1.6.1

I don´t know how you can access your network drive.
If your local machine runs under windows you can map a drive letter
via <exec executable="cmd.exe"><arg line="net use ${letter}
${unc}"/></exec>.

Maybe the <copy> supports UNC - don´t know. You should try that out.



> How to make a zip file with a time stamp .?

First <zip>, then <touch>.



Jan

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


Mime
View raw message