I'm trying to check the existence of several files, without knowing in advance where the files are located. So, I thought of
find as the de facto utility to do this... It works as expected, but the problem is that it does not acknowledge the non-existence of files, that is, if a file does not exists under the searched directory then, as you will expect, it's not showed in the results.
I guess this is fine, as the
find command is meant to find files, which actually exists in the first place (d'oh). But I wonder if there's a way for the
find command to return a message like "File not found" or alike, to inform that the file is not there, instead of failing (or succeeding) silently.
I thought that maybe I could workaround the problem by using
find's return code by querying
$?, but even when the file is not found the return code is
Just an example of what I have...
find . -name foo.sh find . -name bar.sh
and what it returns in case the only file in there is
What I would like to receive is:
./directory/foo.sh bar.sh not found
Does anyone knows of a
find flag or any other workaround I can use?