Reputation: 1742
Scenario
Restore
button on the Web UI is usedRestore
button in the Web UI does not seem to care about the order, and restores files before restoring the folders that contained them.What I need:
How can I recover the information about where the files used to reside, in order to patch this correctly?
What I tried:
I can't find a way of determining what the original folder was for the trashed and incorrectly restored file.
Upvotes: 1
Views: 202
Reputation: 1742
After further investigation I don't think it is possible to recover the information about the previous parents from the Google Drive API v3.
However, if you are using Google Team Drive, as part of the G Suite, you should have access to the G Suite Admin SDK Reports API unless you are on a G Suite Basic account. With that you can use Activities: list with various filters to pull back the information about where the orphaned files came from.
I have published my solution here: Google Team Drive Orphaned File Restorer
This console application can pull a list of Google Drive file movements between two points in time, optionally filtered by the IP Address of the user who made the changes (i.e. restored the files from trash). It will then use that information to re-parent the files in question. You can do a dry run to see what the changes will be before you actually commit.
Upvotes: 1