scriptingibm-cloudrequirementsibm-doors

Create a folder in DXL - DOORS


I am trying to make a script that will copy the contents of one project to another (ie folders and modules) in DXL. To do it, I have seen that there is the create function,

create(string name, string description)

which creates a folder... But from what I see, it creates it in the current directory where I run the script.

Is there any way that running the script in the M module, from the C folder of the P project, generates a folder with the same name C but inside the new NP project?

Thanks:)


Solution

  • from the DXL manual: The name argument can be an absolute or relative name, and may include the path.. So, you might have a loop like

    Project P = project ('/P')
    Item i
    for i in P do {
       if (type i == 'Folder') {
          string nName = name i
          create ("/NP/" sName, "")
       }
       // recursively copy the content of the folder
    }
    

    Also, depending on your needs, you might want to have a look at clipCopy and clipPaste, which duplicates an entire hierarchy.