File f = new File(to);
// check if the file exists
if (f.exists() && !overwrite) {
throw new CommandException("exception.file.exists", new String[] {
to
});
}
// export either a file or a folder
if (node.isNodeType("nt:file")) {
this.createFile(node, f);
} else if (node.isNodeType("nt:folder")) {
this.addFolder(node, f);
} else {
throw new CommandException("exception.not.file.or.folder",
new String[] {
node.getPrimaryNodeType().getName()
});
}