I want to record the folder hierarchy of Google drives, but I can't think of a good way.
The purpose is to periodically record the ID of an item in a shared folder and restore it from Google Apps Script if it is moved incorrectly.If you don't record the folder hierarchy, you won't know which folder to restore to, so I'd like to keep it in a spreadsheet or somewhere.
Please let me know what I should do.
Additional
DriveApp.getFolderById(folderId).getFolders()/.getFiles() successfully retrieves the iterator and writes it to the spreadsheet.
Folder F Folder F Folder F Folder F Folder F Folder F Folder Folder
I'd like to record a folder hierarchy like this.(Even if it doesn't look like this, it can be any format that gives you a full view of the folder hierarchy and tells you which folder it was in when you restored the files and folders.)
google-apps-script
Wouldn't it be better to collect information from the files one tier at a time from DriveApp to getFolders(), getFiles() and spreadsheet them?
"Class DriveApp | Apps Script | Google Developers"
https://developers.google.com/apps-script/reference/drive/drive-app
However, if the number of files and folders is large, it may take too long to retrieve information and cause an error in the middle.
© 2025 OneMinuteCode. All rights reserved.