[VFS] FileObject moveTo() with overwrite?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[VFS] FileObject moveTo() with overwrite?

manco
It would be nice if there was a flag that would allow a move with overwrite.
public void moveTo(FileObject destFile)            throws FileSystemException


public void moveTo(FileObject destFile, boolean fOverwrite)            throws FileSystemException

 

currently I need to do something like the following:

...

if(fOverwrite  && dstFo.exists()
           && destFile.getType() == FileType.FILE)
{
  destFile.delete();
}
try {
   srcFo.moveTo(destFile);

}

...

 

I notice that the copyFrom() implements this type of behavior:


public void copyFrom(FileObject srcFile,                     FileSelector selector)              throws FileSystemException


"...


If this file does not exist, it is created.

Its parent folder is also created, if necessary.

If this file does exist, it is deleted first.

..."


 

Thanks,

Manco





               
---------------------------------
Yahoo! Sports
 Rekindle the Rivalries. Sign up for Fantasy Football
Reply | Threaded
Open this post in threaded view
|

Re: [VFS] FileObject moveTo() with overwrite?

Mario Ivankovits
manco wrote:
>It would be nice if there was a flag that would allow a move with overwrite.
>public void moveTo(FileObject destFile)            throws FileSystemException
>  
The hint with copyFrom was good enough, I think we do not need this
additional flag as copyFrom dont have it either.
I changed moveTo to delete the destination (and all its children) if it
exists.

---
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]