1 Reply Latest reply on May 25, 2011 2:41 PM by frank.closheim

    Creating Folders

      I am using Java Api and I need to create folders hierachy from root library in content DB. For example: root/test/test2/test3 etc ... now I have a function that checks from root directory if folder exists if not it creates one. It is causing a lag in clients application as somtimes there are many levels of folders to go and create. Here is my question is there a way to create a path of folders in CDB in one call. Let say I want to create hierarchy root/test/test2/test3 and i have only root folder. Is it possible that I call some method passing folder path and it will create folder hierarchy form me ? Thank You for Help.
        • 1. Re: Creating Folders

          creating multiple folders just by path (like mkdir -p root/test/test2/test3 on Linux) is not possible with the CDB APIs. However, if you want to create multiple folders with just one call, you can do this with FileManager.createFolders(). Unfortunately this requires that the list of destination folders already exist. In your given scenario this might not be the case.
          Since each folder starting at root can have a different type, i.e. Container, Library or Folder, it would be hard to guess the desired structure just from the path. Plus, you need to add some security and behavior to the top level folders under root. A plain Folder can't be created under root, only Libraries and Containers.

          So in your scenario root/test/test2/test3, what are the folder types of test, test2 and test3? All Containers? test and test2 a Container and test 3 a Library? test a Container, test2 a Library and test3 a Folder? etc. You see?