The Google Drive API has a lot of nuances that you only find through implementation. One such nuance is the fact that documents can be accessed through the API or search box that aren’t part of any folder in your Drive. These are called ‘Orphaned Files’.  Orphaned files are particularly concerning because they are often files that you uploaded to Drive and then deleted, but for some reason Google has decided to hold on to them.

If you don’t read anything else in this post, at the time of writing, I advise AGAINST using Google Drive for any documents where you need to ensure the file is deleted securely. This may be for legal, compliance, or privacy reasons. At this time, it just doesn’t seem like all delete/move/etc requests are properly handled. Here’s more details…

When I open Google Drive on one of my accounts, I have one file in “My Drive” that I put there. But when I access the API, there’s 2 files.  Where is this second file? And how do I handle this file with invalid parameters when using the Google Drive API / SDK?


If I know the name of the file and start typing it in the search box, it magically appears.


This file is not in the ‘Shared with me‘ or ‘Trash‘ folders but it does appear in ‘All Items‘.  I cannot find any reference to it in my Gmail.  How it got there? A mystery.  Some say it was a file that you were collaborating on, and the owner deleted it.  Others claim you clicked “View in Google Docs” from Gmail, and older versions of Google Docs copied it to your Google Drive. Yet others claim that the Google Drive v1 API did not correctly handle deletes and migration from Google Docs, but that the new (as of July 2012) Google Drive v2 API does correctly handle these cases.


People are reporting that they can have lots of these orphaned files.  The only way to delete them is to go to your All Items folder and open them one-by-one and click delete.  A bit tedious.  Google hasn’t even acknowledged the issue.

The bottom line is, if you’re using the API, you need to know how to deal with these files.  They seemingly violate the API rules because the parents field is set to []. This would normally be OK, because you use the [] field to filter orphaned files. Unfortunately files in the ‘Shared with me’ folder are also orphaned (technically), so you have to look at the surrounding fields to figure out the file’s intentions.  Even the StackOverflow answers are only partially correct.

Here’s a quick guide that I put together. This table matches up the fields from the Files resource.

parents shared userPermission Path Orphaned?
[] false any /All items Yes
[] true { id:me, role:owner } /All items Yes
[] true { id:me, role:!owner } /Shared with me No

Note, of course, that Google does not have an ‘Orphaned‘ folder, so the only place to put these docs is in ‘All Items‘. In the last example, the role field could be anything other than owner.

Have you had better luck deciphering the Google Drive orphaned files oddities? If so, help us all out and write it up in the comments.

  1. Ryan (Reply) on Monday 25, 2013
  2. Joel (Reply) on Monday 25, 2013

    I don’t have a solution to better finding these files, but I can shed some light into how they get there. If you have a Google Doc that is in a folder, go to the Organize or Move to… window for that file. If it’s in a folder you will see a check mark next to the folder it is located in. If you hold Ctrl and click on that folder, the checkmark will go away, thus removing that file from the folder. When you click the “Move” button, that file will be no where to be found other than the All Items like you talked about.

    My assumption was that unchecking it from any folder would automatically move it just to the root level of My Drive. This is not the case. I accidentally did this to 10-15 Google Docs and I have no idea what they were named to be able to get them back. I can go to the All Items, but there are hundreds of documents in there, making it very difficult to find just the files that are orphaned.

  3. Jim Kaufman (Reply) on Monday 25, 2013

    I have a similar issue, but the opposite of what you are describing. There are files that SHOULD be on my Google Drive, because I copied them there. Yet, when I try to browse through the folders using my browser window, the files that I am looking for are not there. If I do a search for them with the search window at the top of the screen, they do appear, and I can open and edit them. So, they are obviously still SOMEWHERE on my Google Drive, but they are invisible unless you search specifically for them. Once I find the file, I can find no way to show me the directory path, to be able to directly access the file without having to search for it every time. Where are these files hidden?