The files in the Google domain that I administer are in a bad state; There are thousands of files in the root directory. I want to identify these files and move them to a folder under "My Drive".
When I use the API to display the parents for one of these lost files, the result is an empty array. To determine if a file is lost, I can iterate over all the files in my domain and request a list of parents for each. If the list is empty, I know that the file is lost.
But it is terribly slow.
Can I use the Drive API to search for files that don’t have parents?
The "parents" field for the q parameter is apparently not useful for this, since it can only be indicated that the list of parents contains some identifier.
Update:
I am trying to find a quick way to find elements that really are at the root of the document hierarchy. That is, they are brothers and sisters of “My Drive”, and not children of “My Drive”.
Fishescycle
source share