You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "David F. White" <dw...@opentext.com> on 2004/07/20 17:41:54 UTC
Easy Question: Rename a Directory
Is there an easy way to rename a directory that doesn't have a performance
drain? The Ant documentation states that the "<Rename>" task has been
deprecated and to use "<Move>" instead. However, all the examples I've
seen with the "<Move>" task involve moving all the files and
sub-directories to the new directory and then deleting the old directory:
<move todir="${temp.dir}/newname" includeEmptyDirs="true" overwrite="true">
<fileset dir="${temp.dir}/oldname"/>
</move>
This is not an acceptable solution. All I want to do is re-name a
directory; I don't want to "move" any of its contents. Does anyone have
another solution?
Thanks...
Dave White
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Easy Question: Rename a Directory
Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
David F. White wrote:
>
> Is there an easy way to rename a directory that doesn't have a
> performance drain? The Ant documentation states that the "<Rename>"
> task has been deprecated and to use "<Move>" instead. However, all the
> examples I've seen with the "<Move>" task involve moving all the files
> and sub-directories to the new directory and then deleting the old
> directory:
>
> <move todir="${temp.dir}/newname" includeEmptyDirs="true" overwrite="true">
> <fileset dir="${temp.dir}/oldname"/>
> </move>
>
There is code in <move> to drop down to File.renameTo where possible. It
would be good to understand why this is not happening for you. There may
be some condition which is preventing that from working (filtering, for
example) or it might be a bug. In any case when it can't rename, <move>
goes into copy/delete mode. Can you tell us what is happening in
Move.renameFile?
Cheers
Conor
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org