I am using the find command to search for files or folders from the command line. Is there anyway I can tell find command to exclude a directory while finding files in Linux? I need to exclude /home/project/app2 and /home/project/app3 directory while searching files in /home/project/.
find /search-dir/ -type d \( ! -name dir1 \) -o \( ! -name dir2 \) -print
See the following