I am trying to exclude folders from being searched in for files. It actually works relatively well.
My code looks like this:
find . -type d -regextype posix-extended -regex "(./Scripts/testfolder)" -prune -o -type f -print
My problem is, however, that I would like to exclude all occurences of folder name regardless of path. Basically I want to remove ./Scripts/ part and just ignore testfolder folder, wherever it is. Can it be done by improving the regular expression?
When I run:
find . -type d -regextype posix-extended -regex "(testfolder)" -prune -o -type f -print, the folder is entered and files are fetched.