Closed rvbb closed 1 year ago
I tried to create a folder tree such as a/b/c/d, but Sardine always don't allow: 405 or 409 error will be replied.
public boolean createFolder(String folderName) throws Exception { try { this.sardine.createDirectory(this.baseUrl + "/" + folderName + "/"); return true; } catch (Exception e) { e.printStackTrace(); return false; } } public boolean createFolderTree(String folderTree, String parentFolder) throws Exception { try { if(Util.empty(folderTree) || folderTree.indexOf("/") < 0) { return true; } String parentFirst = folderTree.substring(0, folderTree.indexOf("/")); String subFolderTree = folderTree.substring(folderTree.indexOf("/") + 1); if(!Util.empty(parentFirst)) { if(!Util.empty(parentFolder)) { createFolder(parentFolder + "/" + parentFirst); }else { createFolder(parentFirst); } } createFolderTree(subFolderTree, parentFirst); return true; } catch (Exception e) { e.printStackTrace(); return false; } } `
Plz support.
I tried to create a folder tree such as a/b/c/d, but Sardine always don't allow: 405 or 409 error will be replied.
public boolean createFolder(String folderName) throws Exception { try { this.sardine.createDirectory(this.baseUrl + "/" + folderName + "/"); return true; } catch (Exception e) { e.printStackTrace(); return false; } }
public boolean createFolderTree(String folderTree, String parentFolder) throws Exception { try { if(Util.empty(folderTree) || folderTree.indexOf("/") < 0) { return true; } String parentFirst = folderTree.substring(0, folderTree.indexOf("/")); String subFolderTree = folderTree.substring(folderTree.indexOf("/") + 1); if(!Util.empty(parentFirst)) { if(!Util.empty(parentFolder)) { createFolder(parentFolder + "/" + parentFirst);
}else { createFolder(parentFirst); } }
createFolderTree(subFolderTree, parentFirst); return true; } catch (Exception e) { e.printStackTrace(); return false; } } `
Plz support.