ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <>
Subject Re: [PATCH] Whole directory moves optimized
Date Thu, 01 Nov 2001 10:29:48 GMT
Magesh Umasankar wrote:
> The move task, as it is now, does not optimally perform
> moves of entire directories.  For example, if directory
> A is to be moved to directory B, all files in directory
> A are moved to directory B one by one recursively,
> thereby accomplishing the directory move.
> If the directory itself can be renamed instead of
> taking the above approach, it will greatly improve
> performance.
> [snip]

Won't this fail on e.g. Unix machines when moving a directory between file
systems? In such a case a raw inode rename is impossible. Smart Unix tools
like GNU mv (I think, not sure) will try to do such an optimization. But they
have access to the filesystem mount point information, which is not available
from Java code. And of course other platforms probably have different rules
about when this is permitted.

I guess you could try the rename first, and if it fails, fall back to the copy
and delete. Hopefully File.renameTo is atomic, i.e. it either succeeds or does
nothing. Javadoc does not say.


Jesse Glick        <>
NetBeans, Open APIs  <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message