Hello Everyone I have a quick question about creating a folder that was deleted. I am able to capture the old file path and have been able to recreate the folder only if there are two folder such as /EAM/testing. I need help when there are more than two folders that exist such as /EAM/testing/documents Below is my code
String S = relationRecord.getRepeatingString(
"dp_original_folder_paths", i); //this is the file path I get
String[] folderName = S.split("/");
try {
String userName = "dmadmin";
String userPassword = "xxxxxx";
IDfClient client = DfClient.getLocalClient();
IDfLoginInfo loginInfo = new DfLoginInfo();
loginInfo.setUser(userName);
loginInfo.setPassword(userPassword);
loginInfo.setDomain("");
IDfSession docbase_session = client.newSession(docbase,loginInfo);
folderName[1] = "/" + folderName[1];
IDfSysObject folder = null;
folder = (IDfSysObject) docbase_session.newObject("dm_folder");
folder.setObjectName(folderName[2]);
System.out.println(folderName[1]);
folder.link(folderName[1]);
folder.save();
if(docbase_session != null){
System.out.println("successful create a new folder");
}
else {
System.out.println("failed to create a folder");
}
}
catch(Exception e){
e.printStackTrace();
}
The above code is fully working only when there are two folders.
I was wondering if anyone knew what the code would look like if there were three folders.
I know folder.setObjectName(folderName[3]);
I have tried adding the code
folder.link(folderName[2]);
folder.save();
But I get the error.
DfPathNotFoundException:: THREAD: http-bio-8080-exec-9; MSG: [DM_API_E_EXIST]error:
"Folder specified by /testfolders does not exist."; ERRORCODE: 100; NEXT: null
where /testfolders is the value for folderName[2];
Any help is appreciated very much!