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 Sat, 15 May 2004 00:50:49 GMT
Great it works . Is there a way to create a directory in the network drive
before copying . I want to create the directory with the current datestamp
and then do the copy. In my case the directory folder is hardcoded. 



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

Sorry, I can't. but this is the way you must write your UNC path in a
properties file:
 
\\\\server\\resource\\directory
 
Notice that the backslashes are escaped with backslashes. For more
information on this, please check:
 
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html
<http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html> 
http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#1009
60
<http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#100
960> 
 
HTH
Luis

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



Can you send your properties file ? I am new to Ant.

 


  _____  


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

 

If you read my first mail, you will see: 

[snippet] 
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. 
[snippet] 

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





-----Original Message----- 
From: Partha, SriKrishna 
Sent: Thursday, May 13, 2004 2:00 PM 
To: 'Ant Users List' 
Subject: RE: Requirement to copy from local drive to network drive 

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
<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
<http://ant.apache.org/manual/CoreTasks/copy.html>  
[2] http://ant.apache.org/manual/CoreTypes/mapper.html
<http://ant.apache.org/manual/CoreTypes/mapper.html>  

HTH 
Luis 

-----Original Message----- 
From: Srikrishna.Partha@wellsfargo.com 
[ mailto: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
<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
<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