I wonder how to specify to the command find for searching files under current directory but skipping some specific sub-directories.
For example, I would like to skip sub-directories that match ./dir1/*.1/.
If I would like to exclude subdirectories that match ./dir1/train*.1/, ./dir2/train*.3/, ./dir1/dir3/train*.2/…, how can I specify all of them? I tried -path '\*/train*.*' -prune but it does not work.
You need to use the
-pathoption and the-pruneoption, like this: