How to find files with names having a long string after the first dot

findregular expression

My Samsung Galaxy S doesn't like files where the name contains a long string after the first dot. I guess some part of the software has a too short buffer for the file extension. How can I find all files on my Micro-SD-Card mounted at /media/sd where the filename has more than five characters after the first dot?

Reading the find manpage, I thought

find . -regex '.*\..\{5,\}'

would work, but it doesn't give any hits, so I somehow don't get my regular expression right.

Best Answer

The problem is that the default type of regex's used by find is emacs-style. Find's documentation for emacs style regexes doesn't include the \{n,\} construction--leading me to believe that it isn't supported in find's implemenation of emacs-style regular expressions. The emacs-wiki lists this as valid, however it is possible that this wasn't always the case.

I found that your regex produced output if you do this:

$ find . -regextype posix-basic -regex '.*\..\{5,\}'
Related Question