We have various files in a specific File Cabinet folder that get attached to opportunities. Some of these files go through multiple revisions during the course of the opportunity, and as a new version is added, the previous version is removed from the opportunity. The issue is that those files that get removed essentially become orphaned in the File Cabinet folder while continuing to consume space. We would like to find all those "orphaned" files and delete them to reclaim space. The only way that I can think to do that is via SuiteScript by:
- Perform a document search returning all files in the folder
- Perform an opportunity search returning all linked files in that folder
- Do a set difference between the file IDs in #1 results and #2 results
- Delete all of the files in the set difference
Has anyone encountered this situation and if so, how did you tackle it?
Thank you.
Scott