FileSystem fs2 = oldPath.getFileSystem(conf);
if (fs2.exists(oldPath)) {
// use FsShell to move data to .Trash first rather than delete permanently
FsShell fshell = new FsShell();
fshell.setConf(conf);
fshell.run(new String[]{"-rmr", oldPath.toString()});
}
} catch (Exception e) {
//swallow the exception
LOG.warn("Directory " + oldPath.toString() + " canot be removed.");
}