0

How do I exclude the last file from being selected by find command?

[root@web1 shantanu]# find /home/wcuser/ -name "catalina.out"
/home/user/services/logs/catalina.out
/home/user/services/logs/catalina.out
/home/user/cash/logs/catalina.out

I want to exclude the file "/home/user/cash/logs/catalina.out" from being shown up since it is very old log file.

1 Answer 1

1

You can do this by one of the following commands:

find /home/wcuser/ \( -name "catalina.out" ! -wholename "/home/user/cash/logs/catalina.out" \)


find /home/wcuser/ \( -name "catalina.out" -and ! -wholename "/home/user/cash/logs/catalina.out" \)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.