Reputation: 2300
Very simple question. How can I copy a folder with the Google Drive API?
It looks like the file/copy API endpoint doesn't work with folders (though this limitation is not clearly indicated in the documentation).
Of course I could add a second parent to the file, but obviously that's not a solution as most of the time a folder copy is done to do something with it without modifying the original.
So how can I do that? Any idea?
Upvotes: 8
Views: 3107
Reputation: 682
I've published a pypi package to copy a google drive folder. It basically implements the recursive behaviour described in the first answer
https://pypi.org/project/googledrive-cloner/
Upvotes: 0
Reputation: 22316
'copy' wouldn't make much sense on a folder. The purpose of copy is to create a second file with the same media content as the first. Since a folder has no media content, 'copy' doesn't really apply.
To answer the question, we need to understand your use case a little. Take a *nix paradigm, "cp -R folder1 folder2" is recursively duplicating all of the files. If that is your use case, you'll need to manually recurse down the tree. If you want the same files to appear in two places, (ie. "ln -s folder1 folder2") then that is done by adding a second parent.
Upvotes: 7