On 2/28/23 19:40, Carlos E. R. wrote:
I trying to find png files created recently in my home. So I do:
cer@Telcontar:~> find * -name "*.png" -newermt 2023-01-01
________________________^ That's ambiguous in the case you have files which begin with a '-'; find would treat it as option. Better either use '.', or leave it out completely (dot '.' is the implicit default).
find: ‘Backups Discos/Disco Seagate Basic 2TB para backup de Legolas/Seagate Basic/Seagate’: Permission denied p.png cer@Telcontar:~>
Can I make it not print the error?
no, find(1) does not have an option to suppress this. The others already suggested 2>/dev/null. Obviously, this also swallows other error diagnostics. find / -xdev -type d -not -readable -prune -o -mtime -1 -ls
Prune is not working. Of course I know I'm doing it wrong, but man doesn't say how to do it:
-prune True; if the file is a directory, do not descend into it. If -depth is given, then -prune has no effect. Be- cause -delete implies -depth, you can- not usefully use -prune and -delete together. For example, to skip the directory src/emacs and all files and directories under it, and print the names of the other files found, do something like this: find . -path ./src/emacs -prune -o -print
That's all it says, and no more examples.
There's an example section "Pruning - omitting files and subdirectories" in the find(1) man page, and also the Texinfo manual [1] has examples. [1] https://www.gnu.org/software/findutils/manual/find.html Your example with -prune would be: $ find -type d -not -readable -prune -o -name '*.png' -newermt 2023-01-01 (Mind the '-o' option - look into the manual why this is needed.) Have fun, Berny