Finding file names without dots in their names

By | October 8, 2007

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/with.dot
modlost@optimus:~/tmp$ touch testdir/1/2/3/withoutdots
modlost@optimus:~/tmp$ find testdir -type f -regex '[^.]*'
testdir/1/2/3/withoutdots
testdir/1/withoutdots

Leave Your Comment

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

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>