Find long filenames with GNU find -regex

I am trying to find all long file names in a directory using:

find . -regex './[^/]\{5,\}.txt' 

According to the GNU find documentation, -regex uses emacs regex by default. Thus, this should give me all files longer than 5 characters (excluding the extension). Unfortunately this will not work. It does not match anything. I tried various variations of this topic, but to no avail. Any ideas? Does GNU just donโ€™t find repeat qualifier support?

+4
source share
2 answers

Add

 -regextype posix-extended 

and no need to run { }

 find . -regextype posix-extended -regex './[^/]{5,}.txt' 
+3
source

why is it so difficult?

 find /path -type f -iname "??????*.txt" 
+2
source

All Articles