48

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?

2
  • 4
    If the owners can run Google Drive on their desktop machine (I tried it with Windows) they can duplicate each folder that SHOULD belong to them, and when the copy is re-uploaded to the cloud, all files will fully be in their ownership. Carefully remove the original copy. I'm making this a comment since it's not a true answer. It's a work-around that might be less hassle than some of the other answers. Commented Jul 3, 2017 at 18:56
  • 1
    Related question for how to do this with one item: webapps.stackexchange.com/q/114423/24544
    – Flimm
    Commented Feb 27, 2018 at 9:14

9 Answers 9

23

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.

11
  • 2
    You may want to share the content with the intended person from the GUI first and then use the utility to promote them to owners. Commented Jun 2, 2015 at 21:50
  • 1
    Thanks! I had to fix a small Unicode bug in your script (check the pull requests on github), but then it worked fine. Only downside: It can only change ownership for Google files (docs, stylesheets, etc.), not for uploaded files like PDFs, because Google simply doesn't allow that, neither through the API nor the web interface. :-( Commented Sep 13, 2015 at 16:26
  • 1
    @DavidTimothyStrauss I simply can't transfer ownership of a JPEG or PDF, not even through the web interface. I have a standard ("consumer") Google account. What kind of account do you have? Google says: "Google Apps Customers: Only Google Apps customers in Government and Education domains can transfer ownership of a synced or uploaded file (like a PDF or image file). Consumer Drive users: You can't transfer ownership of a synced or uploaded file (like a PDF or an image file)." support.google.com/drive/answer/2494892 Commented Jan 21, 2016 at 0:19
  • 1
    I've clarified in the answer that certain ownership transfers aren't possible. This isn't a limitation of the script but a limitation of Google Drive. Commented Nov 7, 2016 at 22:30
  • 1
    This script doesn't work with UTF-8. So no éáóúçãõ and lots of other filenames will break the script
    – Freedo
    Commented Jul 12, 2019 at 5:51
14

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).

enter image description here

2
  • 2
    Nice, the critical insight here is that you can select multiple items, right click on the selected collection and change the sharing settings on all at the same time.
    – jorfus
    Commented Jul 17, 2019 at 22:25
  • 2
    As stated in michael's answer, you can't change the ownership of files like zips and PDFs. Also, the web UI is quite slow if there are many items you want to change the ownership of.
    – mic
    Commented Aug 1, 2020 at 17:54
6

A simple method (and slightly different than other suggestions currently posted) to recursively change ownership of all items within a folder:

  1. "right-click" on the top-level folder on which you want to recursively change ownership (OR, in the full directory path shown at the top, click the "down arrow" on the current folder), and select option "Search within {this folder}"
  2. the resulting file list is all files and folders, recursively beneath that folder. Select them all (eg, "ctrl-a" to select all, or shift-click top & bottom items)
  3. right-click all selected items, select "Share"
  4. select the new user to who you wish to assign ownership
  5. select "Make owner" (if different items currently have different owners, it will say "various", but will still give you the option to assign a new owner)

Unfortunately, only google docs and folders can have ownership changed, as per this help page, and if you try to change another file, (e.g, a zip or pdf) you'll get an error like "you can't yet change the owner of this file, we're working on it". Currently, those will have to be downloaded & re-uploaded, it seems.

5
  • I think your solution is the simplest solution. Thanks! Commented Jun 9, 2020 at 6:33
  • The problem with this method is that you only select the files that are displayed, typically 20 at a time. You have to scroll down to display more files. AFAIK there is no method to select all files that was found. I have a folder hierarchy with hundreds of files I want to change ownership of. Any ideas how work around this?
    – d-b
    Commented Nov 5, 2022 at 15:32
  • @d-b true, ctrl-a (mac: cmd-a) does only select the visible (20) items, and as I myself am a keyboard (non-mouse) user, I press (and hold) the end key until it reaches the bottom of the files (but like you say, it loads more items, waits, loads more, waits, etc, until it gets to the bottom). This works for me with over a hundred files (only takes a couple seconds), but no idea if it'll work with several hundred/thousand; perhaps at some point the first items would "scroll out" of the selection buffer (or crash)? (also don't know if chrome works differently than firefox – it very well might).
    – michael
    Commented Nov 7, 2022 at 6:57
  • related, but as of yet (2022) there's no answer beyond what we've talked about here (beyond a reasonable suggestion that drive should implement the gmail feature of "select all not shown, not just those visible") webapps.stackexchange.com/questions/61233/…
    – michael
    Commented Nov 7, 2022 at 7:03
  • 1
    I've tried this solution on a folder containing 1216 files and subfolders (Yes, I scrolled all the way down and then used ctr + a), but it didn't work. It gave me this error: Sorry, an internal error has occurred and your request was not completed. I also tried it once again and a similar error was shown again. So don't try this, at least if you have too many files.
    – aderchox
    Commented Jun 2, 2023 at 10:42
1

You can check several folders, then press right mouse button, choose 'Share', and edit access rights.

Does it work for you?

6
  • 4
    Not recursive, but it helps. Commented Mar 7, 2014 at 19:35
  • 2
    According to Google's help, using the "share" settings at the folder level will only add the new recipient as an "editor" for the existing files in that folder. (From a programming point of view, the files are the children items of the folder.) To actually change the ownership of files, one much click the checkbox on each file and use the "share" option.
    – rwong
    Commented Jul 10, 2015 at 22:49
  • This cannot set me as the new owner where I can only edit.
    – thanos.a
    Commented Nov 13, 2015 at 13:18
  • @9000 This was I can only give the ownership to other users, not get it if I don't have it. In my case I have a folder that contains files. Some of them I own, some other owned by another user. In the end I want to own all files.
    – thanos.a
    Commented Mar 10, 2016 at 8:01
  • 1
    @thanos.a: Security does not work this way. To own a file that somebody else owns, you have to have that somebody give you the access. Imagine someone opening your folder and somehow getting ownership of your files without your consent.
    – 9000
    Commented Mar 10, 2016 at 15:34
1

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.

3
  • 1
    Where is the "All items" option ?
    – thanos.a
    Commented Nov 13, 2015 at 13:19
  • 3
    Google Drive locks up and crashes in the web page when there are too many files.
    – Chloe
    Commented Aug 7, 2017 at 15:28
  • cmd + A for "Select all" is helpful here. Command click to deselect if you must. Commented Sep 12, 2018 at 16:16
1

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.

1
  • Some limitations of Google Takeout: "First off Google Takeout allows the user to the Google Doc's Editor Files as equivalent off-line files. Examples: Doc = Microsoft word, Sheets = Excel. [not as the original Google Docs] Second when downloading Doc Files via Google Takeout it only allows the user to download the files they created (Own)." (support.google.com/docs/thread/9850061?hl=en)
    – mic
    Commented Aug 2, 2020 at 23:23
1

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.

Google - Transfer ownership of Drive documents

enter image description here

6
  • 4
    That would transfer ALL files to another user. I need something that will take a subset of files and change the ownership.
    – Dan Mandle
    Commented Nov 8, 2015 at 14:17
  • 1
    This is used when the other account is about to be removed.
    – thanos.a
    Commented Nov 13, 2015 at 13:32
  • Sorry, wasn't explicit enough. The point is that one could temporarily transfer all to themselves then promptly set desired permissions on each file/folder.
    – shender
    Commented Jan 14, 2016 at 10:58
  • 1
    @musophob You should edit your answer to include that last comment of yours. "Comments are temporary "Post-It" notes left on a question or answer." Commented Sep 4, 2017 at 9:12
  • @VidarS.Ramdal good call!
    – shender
    Commented Apr 26, 2018 at 2:52
1

I wrote a colab to change the ownership of a folder from an account to another. It works with both build-in file types like Google Docs and Sheets, and files like pdf and zip.

For the build-in types, it changes the owner like the script provided in another answer (I was inspired by that), and for other files it downloads them in the colab and reuploads from the other account.

I did this in colab because it have a lot of bandwidth and can download/upload 10Gb in about an hour, but if you have security issues, you can run it locally.

-3

Move the files. You make the folder sharable to the new owner and then have them move everything in it into a new folder. That makes it all theirs and the original owner loses access. They can chose to share it back or not.

2
  • 5
    -1: Moving the files don't change file ownership. Commented Oct 13, 2015 at 19:19
  • 1
    This would also make a mess of the files in all but the most simplistic situations. Also, it may not even be possible to move the files depending on permissions and once owned, this wouldn't be an issue. Further still, I do not believe permissions will be inherited from a "folder", just by "moving" a file/folder into it.
    – rainabba
    Commented Jan 11, 2016 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.