Finding file names without dots in their names

- 1 min

Yesterday, I received an interesting question in a company where I’m a consultant. They wanted to find all file names in the source code of “XYZ” application without dots in their names so they were looking for the easiest way to do this task in GNU/LiNUX.

I’ve never needed to do that kind of search so I’ve recommended to read find command man page and use regular expressions. At home, I’ve found an nice way to do this task:

modlost@optimus:~/tmp$ mkdir -p testdir/1/2/3
modlost@optimus:~/tmp$ touch testdir/1/withoutdots
modlost@optimus:~/tmp$ touch testdir/1/2/
modlost@optimus:~/tmp$ touch testdir/1/2/3/withoutdots
modlost@optimus:~/tmp$ find testdir -type f -regex '[^.]*'
Abner Ballardo

Abner Ballardo

In permanent beta: learning, adapting and evolving

rss facebook twitter github gitlab youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora