I'm looking for a way to optimize my current Box folder scanning function to reduce the number of API calls made to Box.
Currently, I have a desktop application that scans specific Box folders within my organization. Below is the scanning function in Java:private static BoxItem getBoxItemRec(BoxFolder initialFolder, Path locations, int index) throws NotFoundException {
Path currentPath = locations.subpath(0, index + 1);
String location = locations.getName(index).toString();
for (BoxItem.Info info : initialFolder.getChildren()) {
if (info.getName().equalsIgnoreCase(location)) {
if (locations.getNameCount() == index + 1) return (BoxItem) info.getResource();
else return getBoxItemRec((BoxFolder) info.getResource(), locations, index + 1);
}
}
throw new NotFoundException(currentPath + " not exist!");
}
Is there a way to retrieve only the new files that were added within the last X days without scanning the entire Box folder? Ideally, instead of iterating over all the folder files, I would like to generate a list of just the new files from the last X days. The solution doesn't need to be recursive or scan internal folders as my current function does.