I'm trying to run a find
command, and due to the way the folder is set up, I keep getting the following warnings several times in my script:
find -L ./server/ -type f -printf '%s %p\n' | <rest of really long complicated script>
OUTPUT
find: File system loop detected; ‘./server/~andreas/root’ is part of the same file system loop as ‘./’.
find: File system loop detected; ‘./server/~bob/root’ is part of the same file system loop as ‘./’.
find: File system loop detected; ‘./server/~charles/root’ is part of the same file system loop as ‘./’.
...
I know why I'm getting these messages. Those symbolic links are intentionally placed there for other scripts to use, so I want to safely ignore those warnings in the console output.
How can I prevent find
from displaying warnings like "File system loop detected", but still keep all "real" error messages?
I can't just tell find
to ignore every directory named root
. And find has a -nowarn
option, but I can't get it to work no matter where I place it. And so far I haven't found a "log level" option for find.
find
manual about-nowarn
: "These warnings apply only to the command line usage, not to any conditions thatfind
might encounter when it searches directories". The warnings you want to ignore are of the latter type. This is why you "can't get it to work". – Kamil Maciorowski Jan 14 '21 at 23:52