Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
task to 'cp -r --reply=no '

task to 'cp -r --reply=no '

2007-06-12       - By Gilbert Rebhan
Reply:     1     2     3     4     5     6     7     8     9     10  

Hi,

Matt Benson wrote:
> Hi Chris:
>   Try using a <present present="srconly" ... />
> selector with your source <fileset>.
>
> HTH,
> Matt

Nice :-)


before =

J:\copyfrom\subdir1\
J:\copyfrom\subdir1\build.xml
J:\copyfrom\subdir2\
J:\copyfrom\subdir2\subsub2\build.xml
J:\copyfrom\build.xml

and
J:\copyto is a blank directory

with =

<?xml version="1.0"?>

<project name="bla" default="main">

  <target name="init">
    <fileset dir="J:/copyfrom" includes="**/*.xml" id="newfiles">
      <present present="srconly" targetdir="J:/copyto"/>
    </fileset>
  </target>

    <target name="main" depends="init">
    <echo>
     Files to copy = ${line.separator}${toString:newfiles}
    </echo>

    <copy todir="J:/copyto">
      <fileset refid="newfiles"/>
    </copy>

  </target>

</project>

first run =

Buildfile: J:\eclipse_3_2\workspace\AntTest\test.xml
init:
main:
     [echo] Files to copy =
     [echo] build.xml;subdir1\build.xml;subdir2\subsub2\build.xml
     [copy] Copying 3 files to J:\copyto
BUILD SUCCESSFUL
Total time: 891 milliseconds

the blank directory gets filled with meat =

J:\copyto\subdir1\
J:\copyto\subdir1\build.xml
J:\copyto\subdir2\
J:\copyto\subdir2\subsub2\build.xml
J:\copyto\build.xml

second run =

Buildfile: J:\eclipse_3_2\workspace\AntTest\test.xml
init:
main:
     [echo] Files to copy =
BUILD SUCCESSFUL
Total time: 516 milliseconds

so no files are copied, as already present in targetdir ...


Blank directorie are not copied, how to achieve that if wanted ?
(manual says <cop<> task is set to ncludeEmptyDirs="true" ?


Regards, Gilbert






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.