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 -path option and the -prune option, like this:
find . -type d -path "./dir1/*.1" -prune -o -print
Check this out. EDIT: Straight from the man page: `To ignore a directory and the files under it, use -prune'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With