/** rename a file or directory. If the two are on different file systems, it is assumed to be a file */
public static boolean rename(String sourceFilename, String destFilename)
{
sourceFilename = transform(sourceFilename);
destFilename = transform(destFilename);
final FileSystem destFS = getFileSystem(destFilename);
final FileSystem sourceFS = getFileSystem(sourceFilename);
try{
if (destFS == sourceFS)//yes, that's object equals
{
sourceFS.rename(sourceFilename, destFilename);
}
else
{
copyFile(sourceFS.openFileStream(sourceFilename), destFS.writeFileStream(destFilename));
sourceFS.delete(sourceFilename);
}
return true;
} catch (IOException ioe) {
return false;
}