osx - bash: recursively find all files that match a certain pattern -


I need to find (or more specifically, count) all the files that match this method:

* / foo / * Doc

Where the first wildcard star contains a variable number of subdirectories

You can use regex with GNU, which match the entire path (as opposed to -name ):

  find -reggets'. * / Foo / [^ /] *. Doc '  

Just to calculate the number of files:

  find -reggets'. * / Foo / [^ /] *. Doctor '-printf'% i \ n '| Wc -l   

(% i format code find to print the inode number instead of the file code), the filename In contrast, the inode number is guaranteed that there is not a new line like letters, so the count is more reliable. Thanks for the @Tripple for the suggestion.)

I do not know if it will work on OSX, though.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -