I managed to make a scenario that recursively calls itself to copy files and files within subfolders.
Overview
Here is a screenshot of how the scenario looks like:
As you can see, many API calls are needed to be made to fetch folder IDs and path names from folder IDs, and create the destination folder if it doesn’t exist.
However, this approach allows flexibility of the initial input and allows the scenario to also recursively call itself, as well as handle potential errors and resuming of errors.
Limitations
The only limitation I can think of is the scenario maximum run time, which is 5 minutes on the free plan, and 40 minutes on paid plans. If the folder structure you are trying to copy is very deep and has lots of subfolders, you may find that the scenario runs out of time.
On average, it takes up to 25 seconds to make a copy of the main folder, and 25 seconds for each subsequent subfolder. This is because the API call to fetch a folder ID by path is very slow.
Inputs
source
Can be either Folder Path (from the root of your drive), or Folder ID
dest
Can be either Folder Path (from the root of your drive), or Folder Name (placed in same directory-level as source folder)
Demo Run
Postman Screenshot
(it took about 52s since there is the main plus one subfolder)
Screenshot showing folder and subfolder copied too
(not shown in screenshot: one test file within the subfolder)
Conclusion / TL;DR
As you can see, it is possible to make a scenario that recursively copies an entire folder and it’s contents including subfolders. However, it may take a number of operations and may be slow since you need to reference and copy files and folders by ID, check if the source and destination folder exists, and if not create it, check if the scenario has the appropriate permissions to copy the files, handle errors, and provide appropriate webhook responses.