Solve this problem by using the copy_node event to move each file in a folder up the tree after copying and deleting the folder after all files are deleted from it
$('#tree').on("copy_node.jstree", function(e, data){
if(data.node.icon.indexOf("folder")!=-1){
var children = data.node.children;
while(children.length > 0){
var node = $('#tree').jstree().get_node(children[0]);
$('#tree').jstree("move_node", node, "#", "before");
}
$('#tree').jstree("delete_node", data.node.id);
}
}
source
share