On Wed, 8 Mar 2023 21:11:44 +0100 (CET), "Carlos E. R."
El 2023-03-08 a las 03:25 -0000, Robert Webb escribió:
For the first one, try:
find . \( -path ./.dosemu -o -path ./.cache \) -prune \ -o -name "*.png" -newermt 2023-01-01
This works:
cer@Telcontar:~> find . \( -path ./.dosemu -o -path ./.cache \) -prune -o -name "*.jpg" -o -name "*.png" -newermt 2023-01-01 2>&1 | grep -v 'Permission denied'
but produces a lot of entries I do not want: [...] Ok, again.
cer@Telcontar:~> find . \( -path ./.dosemu -o -path ./.cache -o -path ./.wine -o -path ./.kodi \) -prune -o -name "*.jpg" -o -name "*.png" -newermt 2023-01-01 2>&1 | grep -v 'Permission denied' | less -S ... ./Fotos Eclipse/DSC_5861.jpg ./Fotos Eclipse/DSC_5786.jpg ./Fotos Eclipse/DSC_5893.jpg
That can not be. [...] How come? It is ignoring the "-newermt 2023-01-01" part.
OK. My bad. Short answer: Add a -print to the sub-expression you want to see results from. I often forget this. 'find' defaults to printing the path of everything that evaluates true, according to the *whole* expression, unless you include a -print, or -exec, or something like that. This means that whatever you pruned, or intended to exclude by matching it with another or'ed sub-expression, still gets printed, by default. So: find . \( -path ./.dosemu -o -path ./.cache -o -path ./.wine \ -o -path ./.kodi \) -prune \ -o -name "*.jpg" \ -o -name "*.png" -newermt 2023-01-01 -print 2>&1 \ | grep -v 'Permission denied' | less -S -- Robert Webb