I am trying to use the Node.js to query a dropbox folder from the back-end of my website, which is hosted on Wix. This folder may have thousands of files, and I want a daily routine on my website to run and delete files older than "X" days (ex: 30 days) from this folder.
In reviewing the APIs there does not seem to be a way to do this, other than to use the filesListFolder() API, then loop through the results and check the metadata of each individual entry to review the date and see whether or not it's created date property is later than the designated time. For example, while this works:
// Loop through the results, do a continue as needed, etc.
I get a valid set of results back, so I know my connection to Dropbox is working correctly, but given that I may have thousands, or tens of thousands of files, I need to find a better way to filter the return values. Otherwise, each month I will have to loop through every single file just to find the ones that have "expired".
Unfortunately, the Dropbox API doesn't offer a way to list/filter files only since a specific date, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.