Delete permissions for folders before files
Often the same permission will be on several files as it was applied to the (grand)parent folder.
In some cases, where the grandparent isn't owned by the owner of the files whose permissions are being removed, the individual file permission can repeatedly fail with a 403 The user does not have sufficient permissions for this file
.
Deleting folder permissions (and even trying to start at the top of a tree of folders) would prevent this, and additionally mean more later request will just get a 404 as the permission has already been removed. Hopefully, speeding up the scan.
Note: folders have a mimeType: application/vnd.google-apps.folder
and both files and folders has a parents
list.
Edited by Robin Goodall