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 -- Jesse Glick <mailto:[EMAIL PROTECTED]> NetBeans, Open APIs <http://www.netbeans.org/> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
