UNIX / GNU find command

Find all directories within a path that contain files matching pattern:

find . -type f -iname *adf -printf "%h\n" | sort | uniq >/tmp/adf_dirs.txt

Above is using simple wildcard matching, it is also possible to use regex:

find . -regextype sed -iregex ".*/.*\.adf$" -printf "%h\n"|sort|uniq >/tmp/adf_dirs.txt

https://stackoverflow.com/questions/6844785/how-to-use-regex-with-find-command

Leave a Reply

Your email address will not be published. Required fields are marked *