Ignoring files that find cannnot search or open

commandfindscripting

I searched for big files using this command on HP Unix:

find . -type f -size +100000000c -exec ls -lrt {} \;

The result came out somthing like this:

-rw-rw-rw-   1 qa1wrk32   test       169263642 Oct 27 12:28 ./rgs/test/qa1wrk32/DB/Dmp/intrefbl01_20111027_Backup_for_qa1ref32_CNSTRNO.dmp.gz
-rw-rw-rw-   1 qa1wrk32   test       173779937 Oct 24 16:33 ./rgs/test/qa1wrk32/DB/Dmp/qa1ref32_20111024_Backup_before_Refresh.dmp.gz
-rw-rw-rw-   1 qa1wrk32   test       105020030 Oct 31 09:53 ./rgs/test/qa1wrk32/DB/Dmp/qa1app32_20111031_R112_Before_CopyBan_from_INT01_to_ENV32_for_LISA_CNSTRNO.dmp.gz
find: cannot open ./rgs/test/maes32/master/.ssh
find: cannot open ./rgs/test/qa1oln32/.ssh
find: cannot open ./rgs/test/qa1oln32/local_tlg/bin/.adm
find: cannot search ./rgs/test/qa1wrk91/mail

I don't want the lines of output where find fails to search or open or anything else. Is there a way to filter them out? Better yet, can I make find search for files with some set of permissions?

Best Answer

find prints the errors to stderr. If you just want to ignore them, the simplest thing to do is:

find ... 2> /dev/null

find also has the -perm option to filter based on permissions.

Related Question