You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ryan Owens <ry...@infoether.com> on 2004/08/17 17:54:12 UTC

Copy without overwriting.

Hello all.
I need to copy a set of files to a directory, but not overwrite a file 
if it exists.
In other words I only want to copy files that have not been previously 
copied.

this is what I have in my maven goal now:

   <copy todir="${maven.src.dir}/java" overwrite="false">
             <fileset dir="${mydir.dest}/java">
                 <include name="**/*.java" />
             </fileset>
   </copy>

The ant copy task's 'overwrite' attribute only prevents a copy if the 
destination file is newer, so this snippet doesn't work.
I need to prevent a copy if the destination file exists at all.
This may be more of an ant question but I've scoured all the ant 
resources I can find and I'm thinking I need to use jelly or something.
Is there a better way to copy in Maven than using the ant copy task?

Thanks for your time and help!


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Copy without overwriting.

Posted by Carlos Sanchez <ap...@carlos.cousas.net>.
Hi,

You can surround it with a <j:if test="${something}"> maybe used with the
uptodate ant task

Regards

Carlos Sanchez
A Coruña, Spain

Oness Project
http://oness.sourceforge.net
 

> -----Original Message-----
> From: Ryan Owens [mailto:ryan@infoether.com] 
> Sent: Tuesday, August 17, 2004 5:54 PM
> To: Maven Users List
> Subject: Copy without overwriting.
> 
> Hello all.
> I need to copy a set of files to a directory, but not 
> overwrite a file if it exists.
> In other words I only want to copy files that have not been 
> previously copied.
> 
> this is what I have in my maven goal now:
> 
>    <copy todir="${maven.src.dir}/java" overwrite="false">
>              <fileset dir="${mydir.dest}/java">
>                  <include name="**/*.java" />
>              </fileset>
>    </copy>
> 
> The ant copy task's 'overwrite' attribute only prevents a 
> copy if the destination file is newer, so this snippet doesn't work.
> I need to prevent a copy if the destination file exists at all.
> This may be more of an ant question but I've scoured all the 
> ant resources I can find and I'm thinking I need to use jelly 
> or something.
> Is there a better way to copy in Maven than using the ant copy task?
> 
> Thanks for your time and help!
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org