Home:ALL Converter>Duplicate N-times Sling resouce

Duplicate N-times Sling resouce

Ask Time:2019-03-23T00:47:30         Author:CeZet

Json Formatter

I have a sling JCR resource tree, there is resource folder named test and file named testFile inside. testFile have own structure(subnodes/files) inside, I want copy all of them(with subnodes)

/root
   |_test
       |_testFile

For server test I want to make copy N-times of this file. Any idea how to do it using ResourceResolver ?

I need to have as below:

/root
   |_test
       |_testFile
       |_testFile1
           ...
       |_testFileN

Author:CeZet,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/55304311/duplicate-n-times-sling-resouce
yy