Linux Find Files Ignore Few Directory


When you want to search for files in all folder expect few selected folders you can use the below command as reference, this will find the files with name *bkp* , *bak* & *old* in all the folders under /psoft/pt848, but will ignore the directories like psreports & log_output


find /psoft/pt848 -path '*psreports*' -prune -o -path '*log_output*' -prune -o -type f \( -iname "*bkp*" -o -iname "*bak*" -o -iname "*old*" \) -exec ls -lh {} \;

Happy Sharing
Sandeep G