commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manco <megust...@yahoo.com>
Subject [VFS] FileObject moveTo() with overwrite?
Date Mon, 20 Jun 2005 23:39:55 GMT
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
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message