Hi ![]()
I noticed that there is no Make module for duplicating or copying an existing Google Drive folder including subfolders. Seems like this is not even available in the Google Drive API.
This topic has already discussed been discussed before here:
Here is the solution how I solved it by retrieving the template folder and it’s structure and then recreating it dynamically:
The folder structure in my example is as folllows:
- Client Folder
- 1st level folders
- 2nd level folders
- 1st level folders
Step 1: Create Client folder
Step 2: Get the template folder (1st level of folders)
Router: To filter for folders only since I also retrive files, which I also want to duplicate later (but you can ignore this for this post)
Step 3: Get 2nd level folders (from parent folders of step 2)
Step 4 (Optional): Set the folder names as variables. You don’t really need this module, it costs additional credits but it makes it easier to check which folders have been retrieved.
Step 5: Aggregate both variables from step 4 and group them by 1st level folders
Step 6: Create the 1st level folders. Map the key of step 5 as name (= “folder_name_1st_level”) and make sure to add the folder ID of step 1 into the path, so the folders will be created in the previously created client folder.
Step 7: Iterate the array from step 5 with the “folder_name_2nd_level”.
Step 8: Create the 2nd level folders. Map the key of step 5 as name (= “folder_name_2nd_level”) and make sure to add the folder ID of step 6 into the path, so the folders will be created in the previously created parent folder.
It took me ~30 minutes to build. The beauty of this solution is that the template folder can be modified at any time and the automation will always duplicate the latest version. The only need to change would be if a 3rd layer of nested folders would be introduced, then this would need to be added in the same fashion.
I hope this solution can be helpful for others as well ![]()
Pierre



