Skip to main content

Transferring ownership of orphaned files

Scenario

John Smith shares a folder on his My Drive with Jane Parker. Jane uploads a 20 GB video file to that folder. Because Jane owns the file and it lives in a My Drive (not a Shared Drive), it counts against her storage quota — not John’s. When offboarding Jane, you move 80 GB from her My Drive to a Shared Drive, but 20 GB of quota remains in use. At account deletion, Google presents two options:
  • Do Not Transfer — deletes the 20 GB file that Jane owns, even though it resides in John’s drive.
  • Transfer — reassigns ownership to another user, consuming 20 GB of their quota.
Neither option is acceptable. The root cause is that file ownership is tied to the file owner, not the directory owner.

Resolution

Run the following commands to find files owned by Jane that live in other users’ My Drives, then reassign ownership to the respective drive owner.

Step 1: Generate a CSV listing files owned by Jane in other users’ My Drives

gam all users show filelist corpora user showownedby others fullquery "'jane.parker@domain.tld' in owners" name id owners > ownedbyoffboarded.csv

Step 2: Reassign ownership to the My Drive owner for each file in the CSV

Jane is downgraded to Editor on each affected file. The files remain visible to her under “Shared with me”, and quota usage shifts to the respective My Drive owner.
gam csv ownedbyoffboarded.csv gam user jane.parker@domain.tld transfer ownership "~id" "~Owner"

Step 3 (optional): Remove Jane’s access from the affected files

Use this if you don’t want to leave Jane with editor access to files now owned by others.
gam csv ownedbyoffboarded.csv gam user "~Owner" delete drivefileacl "~id" jane.parker@domain.tld

Notes

  • Files still present in Jane’s My Drive are not affected by this process.
  • If a folder ID appears in the CSV from Step 1, Step 2 will scan that folder recursively. Only files where Jane is currently the owner are affected.