How to copy only the child nodes of a folder to another location inside Content Server?

Hi Experts,

I need some directions on how to copy only child nodes of a folder(TestA) inside content server to another folder(TestB)?

When I am using NODEACTION:COPY:<Container>:CHILDREN tag, it is coping all the child nodes including the folder TestA. So here I just want to copy only the child nodes.

Is there any direct webreport tag or any hints would be appreciated.


Thanks

Comments

  • appuq
    edited January 16, 2023 #2
    Children of Source folder: [LL_REPTAG_"615013" CHILDREN SETVAR:atc SHOW /] <br>
    
    Destination: [LL_REPTAG_"615014" /] - [LL_REPTAG_"615014" NODEINFO:NAME /]<br>
    
    [LL_WEBREPORT_FOR DATA:"[LL_REPTAG_!atc /]" VAR:i /]
          COPYING SOURCE: [LL_REPTAG_!i RECORD:DATAID SETVAR:CURRENTNODE SHOW /] - OBJECT CALLED [LL_REPTAG_!i RECORD:DATAID NODEINFO:NAME SHOW /]<br>
         [LL_REPTAG_!CURRENTNODE NODEACTION:COPY:[LL_REPTAG_"615014" /] /]<BR>
    [LL_WEBREPORT_ENDFOR /]
    

    CODE is a hard coded demo quality so if to test this you just need a WR html with no source. If you know where the header or footer exists that is where this goes.

    written with no consideration to error handling etc. If you look at the code we are looping the source and when the loop runs we are copying to value to a variable called CURRENTNODE. It is akin to me saying select DataID from DTREE where parentid=615013.The NODEACTION subtag is a server side operation so when the code finishes you get output meaning the subnodes under 615013 will go to 615014.In Prod worthy code one traps Nodeaction to handle that situation.

    Assume your bad fortune that 615013 contains a folder called Level1 Child1 that has say 200000 items and then at the same time something called Level1 Child2.the loop will only do Level1Child2 only after the 200000 items has finished and the api successful I think .So while the above is good for you to understand ,I imply no efficiency/warranty to the above code.

    If you have such concerns looks in the paid WR Forum for old posts (including mine) that shows chunking ways in WR.

  • Use a webreport or a similar method to create a custom query that lists all the child nodes of TestA. You'll want to retrieve the list of child nodes without including the TestA folder itself.

    Once you have the list of child nodes, you can use the NODEACTION:COPY tag to copy each child node individually to the destination folder, TestB.