You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Joyce Li <jl...@dwl.com> on 2002/08/13 22:50:07 UTC

Moving a set of directories.

Hi,

I'm having some trouble moving a set of directories to a new location.
The source location is not deleted after the move.

For example, I have

A/dir1
A/dir2
A/dir3

and I'd like to move dir1 and dir2 to a new location B so I can have

A/dir3
B/dir1
B/dir2

My build.xml segment is something like this:

        < move todir="${base.dir}/B">
            <fileset dir="${base.dir}/A"
                     defaultexcludes="no">
                <include name="dir1/**"/>
                <include name="dir2/**"/>
            </fileset>
        </move>

After the move operation, I have

A/dir1  <with only empty directories>
A/dir2  <with only empty directories>
A/dir3
B/dir1
B/dir2

Why aren't dir1 and dir2 removed from A?

Please help.

Thanks.
Joyce


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Moving a set of directories.

Posted by Geoff Meakin <ge...@isocra.com>.
Hi Joyce,

this looks like a bug to me. Unless this has been resolved in 1.5release,
although nothing was ever logged against previous versions of ANT
(checking the bug database). It looks like the only way to physically
move a whole directory is to say:

<move todir="new.dir.name">
  <fileset dir="old.dir.name"
           defaultexcludes="no">
    <include name="**/*.*"/>
  </fileset>
</move>

(the include is not needed in this case)

I'm sure this was not what was originally intended. I think in your
example you should be able to do:

<move todir="new.dir.name" includeEmptyDirs="true">
  <fileset dir="old.dir.name"
           defaultexcludes="no">
    <include name="dir1/**/*.*"/>
    <include name="dir1"/>
  </fileset>
</move>

and that should move the empty directory dir1, which it doesn't.
Has this been resolved in ANT1.5? Opinions people?

Cheers 
-Geoff


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>