We recently moved from Dropbox to Google Drive for our whole company and I used one user account to move everything into Google Drive. Now most/all of the file/folders are owned by one account. The folders are broken out by department and I'd like to set the owner of all of the files inside of that folder to the department head. Is there a way to do that without going into each folder? I'd like to solve this in the webapp, but if not, how can I do this with the API?
I created a command-line tool to handle this.
After following the setup instructions on the GitHub project, you can run the tool with a specified path prefix and the email address of the new owner:
python transfer.py PATH-PREFIX NEW-OWNER-EMAIL
After getting authorization from OAuth, it will recursively walk the Google Drive account it got authorization to, match against the path prefix (ignoring non-matches), and then transfer ownership to the new email. If the new email address indicates a user who isn't even shared on the item yet, it will handle that as well. The current owner will not lose access, but the new or old owner can revoke it.
I should note that it's not always possible to transfer ownership of an item in Drive. For example, it's not possible to move ownership for an item from G Suite (Google Apps for Work) account to a normal GMail account. It can be shared (which the script will do), but ownership transfer will fail.
Seems like a very simple process to me...
You can use the search bar at the top of the WebGUI for Google Drive. Just select your user's username in the
owner dropdown, choose the
type (such as folder if you want to), choose the location of the folder you want to turn owner to the department head, then click search.
In the search results, select as many folders as you want to process in one round (I like to do it in chunks so I can see progress). Then right click, "share". Set the department head user to OWNER rather than write access.
Rinse and repeat as needed (if you do the same thing again the files you have already converted will not show up in your search of course because they are now owned by the department head).
The best way I have found to do this is to head on over to the "All Items" view, keep on scrolling down until no more files load, and then hit the tick box on top which selects all files and folders in the current view. Once all items are selected, click more, and then share and share again. In the share box change to the appropriate sharing levels and click done.
The only caveat here is you change the permissions for ALL of your files and folders.
The best way I could find for consumer Gmail with a shared folder where files and subfolders are owned by different people: log in to the account which holds the files, go to "My account" -> "Manage Content" and download all files. The zip contains all files in the original structure. The re-upload (including overwriting) all files with the new owner account.
For Google Apps users: the administrator can sign in to https://admin.google.com/ and navigate to Apps > Google Apps > Drive > Transfer Ownership. This operation keeps the files accessible to both users but recursively changes ownership of every file/folder from UserA to UserB; one could temporarily transfer all to themselves then promptly set desired permissions on each file/folder.