ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: cp or <copy> in windows?
Date Tue, 16 Mar 2004 06:36:19 GMT
Using <copy> you can copy the files in a cross platform manner.

Setting the permissions the perms of the original files is another
topic. <chmod> is used to set permission. But there is no easy way
to "copy" the permissions from one fileset to a target. You can
use <script> and <chmod>: iterate over a src-fileset, if the file exists
in a target dir, get the file permissions from src and set them on target.

If "cp" does the job you can use dependend targets for copying:

  <target name="copy"
depends="copy.check,copy.withPerms,copy.withoutPerms"/>

  <taret name="copy.check">
      <condition property="copy.withPerms">
          <os family="unix"/>
      </>
  </>

  <target name="copy.withoutPerms" unless="copy.withPerms">
      <copy> ... </>
  </>

  <target name="copy.withPerms" if="copy.withPerms">
      <exec executable="sh"><arg line="cp ..."/></>
  </>

(syntax not checked :)


Jan

> -----Original Message-----
> From: Baz [mailto:barry@goodconsultants.com]
> Sent: Tuesday, March 16, 2004 6:02 AM
> To: Ant Users List
> Subject: cp or <copy> in windows?
> 
> 
> All,
> 
> I am trying to support both Dos and cygwin in Windows  as 
> well as all Unix
> platforms. I am trying to copy some files and was using 
> <copy>, and soon
> enough, i found out from the manual that the <copy> does not preserve
> permission and using "cp" is recommended.
> 
> So my question is: How can copy files in a task that is cross 
> platform?
> 
> Thanks.
> 
> Barry
> 
> 
> 
> ---------------------------------------------------------------------
> 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