I have used copydir
to copy a directory tree but it is deprecated. My directory contains some sub-directories, and some of those contain files and others contain more sub-directories.
How can I copy the entire tree?
To copy files or directories in Unix-based operating systems (Linux and MacOS), you use the cp command. The cp command is a relatively simple command, but its behavior changes slightly depending on the inputs (files vs directories) and the options you pass to it.
A FileSet is a group of files. These files can be found in a directory tree starting in a base directory and are matched by patterns taken from a number of PatternSets and Selectors. PatternSets can be specified as nested <patternset> elements.
It allows you to reuse the same build file, with different property settings for different execution environment. For example, build properties file can be maintained separately for DEV, TEST, and PROD environments. It is useful, when you do not know the values for a property (in a particular environment) up-front.
<copy todir="${dest.dir}" >
<fileset dir="${src.dir}" includes="**"/>
</copy>
believe that will do what you want... (Recursive copy done)
Copy contents including the directory itself.
<copy todir="${dest.dir}" >
<fileset dir="${src.dir.parent}">
<include name="${src.dir}/**"/>
</fileset>
</copy>
Note: ${src.dir} is relative to ${src.dir.parent}, and not a full path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With