1751972 Members
5030 Online
108784 Solutions
New Discussion юеВ

dot files

 
SOLVED
Go to solution
nightwich
Valued Contributor

dot files

How to list all files that start whit a dot ( ex .aj .cshrc etc ) from one directories and is sub-directories


4 REPLIES 4
Pete Randall
Outstanding Contributor
Solution

Re: dot files

find /startdir -name ".*"


Pete

Pete
Patrick Wallek
Honored Contributor

Re: dot files

>>find /startdir -name ".*"

The problem there is that it'll pick up ".." as well, which is probably not wanted.

Try this:

find /startdir -name ".[a-zA-Z0-9]*"

The above will find any dotfile that starts with a lower case letter, upper case letter, or a digit.
nightwich
Valued Contributor

Re: dot files

I already have tried those options but without the ("). That was the problem.


Thanks for the answer ten points !!


Best regards.

Dennis Handly
Acclaimed Contributor

Re: dot files

>Patrick: find /startdir -name ".[a-zA-Z0-9]*"

Or use the following to exclude the ".": -name ".[!.]*"

This won't find "..abc". To get those:
\( -name ".[!.]*" -o -name "..?*" \)