If I'm excluding that folder, why is KM still searching inside?
I tried the same script with a "tests" folder, and it's working, so the issue doesn't seem to be the script itself. It's something related to that folder, but if it's supposed to be excluded, why is it trying to search there?
find will try to traverse all directories even if they are excluded from the results, so if you dont' have permission, the script will still throw an error. I believe you need to prune the folder from the search instead.
The -o is OR. According to the find man page, this is how prune is intended to work:
The idea here is that the expression before -prune matches
things which are to be pruned. However, the -prune action
itself returns true, so the following -o ensures that the
right hand side is evaluated only for those directories
which didn't get pruned (the contents of the pruned
directories are not even visited, so their contents are
irrelevant).
I noticed the same when i just tested again, try removing the *
No problem, I understand.
If you have time, do you know why I would still get files that were not modified in the last 30min still showing up? That's another weird thing.
It seems that the issue with those files showing up, even though their modification date is not a match, is also related to that same folder "Saved Application State". Since I don't need to have that on my list, I just used the initial script you shared that throw no errors, saved that to a variable, then used the Search and Replace with: ^(\/Users\/dannywyatt\/Library\/Saved Application State\/.*)
to remove those lines.
Sometimes you gotta make it work some other way
Thanks for sharing that prune solution. It really helped!