What is the simplest way to move everything out of a target directory?
I have this basedir/parentdir/<subdir>
. I have many different <subdir>
. I need to move them out into the same level as parentdir
so that it becomes basedir/<subdir>
. Now, each <subdir>
contains a deep tree of many other subdirectories and files, including empty subdirectories.
I've tried the following:
<move todir="basedir">
<fileset dir="parentdir">
<include name="**/*.*" />
</fileset>
</move>
That failed to move the empty directories - meaning after the move, all the <subdir>
are missing their empty subdirectories. "move" supposedly copies emptysubdirectories by default, so I tried the following next:
<move todir="basedir">
<fileset dir="parentdir">
<include name="**/*" />
<include name="**/*.*" />
</fileset>
</move>
While I did manage to move the empty subdirectories, the strange thing is that all the immediate subdirectories of all the <subdir>
gets copied into basedir
. Every <subdir>
has src
, test
, and build
. These are now sitting in basedir
as well as in their original moved <subdir>
.
I'm positive I'm doing something wrong but I don't know what. Am I approaching things the wrong way?
Try this
<project name="moveproject" basedir="." default="moveDirs">
<target name="moveDirs">
<move todir="${basedir}" includeEmptyDirs="yes" verbose="true">
<fileset dir="parentdir" >
<include name="**/*" />
</fileset>
</move>
</target>
</project>
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