Using jbossapp user I'm using this command to find .stat files which are created more than 3 minutes. find /opt/jboss/* -mmin +3 -name *.stat Recently there is a folder created in /opt/jboss/ directory with root user now while using this command I'm getting 'permission denied' from the particular folder which is interrupting the search how do I exclude the particular folder which is having root privileges.
How to find a file which is created after 5 mins exclude one sub directory which is owned by root user
command line;find
Use find /opt/jboss/* -type f -mmin +3 -name *.stat 2>/dev/nullThe 2>/dev/null will redirect the Standard Error Output to special file /dev/null to avoid displaying any errors.Also we add -type f to look for fIles only. To excluding a directory use like below find /opt/jboss/* -path /path/to/exclude -prune -o -type f -mmin +3 -name *.stat 2>/dev/nullalso you can use -not -path as well. find /opt/jboss/* -not -path /path/to/exclude -type f -mmin +3 -name *.stat 2>/dev/nullEven if you want exclude the find result from users who owned by root, use as follow:find . \! -user root   ..... 