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:[EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to