Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy Multiple Files and Directories with ANT

Tags:

java

ant

I have an Ant Script, using the ANT LIBRARY how can i copy multiple files/folders to multiple directories. I use a properties file which contains

FileToCopy = DestinationFolder
FolderToCopy = FolderDestination
like image 708
M.Hussaini Avatar asked Dec 06 '22 14:12

M.Hussaini


1 Answers

Copy a single file

<copy file="myfile.txt" tofile="mycopy.txt"/>

Copy a single file to a directory

<copy file="myfile.txt" todir="../some/other/dir"/>

Copy a directory to another directory

<copy todir="../new/dir">
   <fileset dir="src_dir"/>
 </copy>

Copy a set of files to a directory

<copy todir="../dest/dir">
  <fileset dir="src_dir">
     <exclude name="**/*.java"/>
   </fileset>
</copy>

 <copy todir="../dest/dir">
    <fileset dir="src_dir" excludes="**/*.java"/>
 </copy>

examples from copy ant task

like image 73
sergiofbsilva Avatar answered Dec 14 '22 20:12

sergiofbsilva