The usual wisdom for UNIX is to use something like:
rm -rf * .[!.]* ..?*
That will list all files that start with a dot or even double dot (without including the plain double dot (./..
).
But that globbing expansion will keep the asterisk if files of that type do not exist.
Let's test:
$ mkdir temp5; cd temp5
$ touch {,.,..}{aa,bb,cc}
$ echo $(find .)
. ./aa ./cc ./..bb ./..aa ./.cc ./.bb ./..cc ./.aa ./bb
And, as indicated, this will include all files:
$ echo * .[!.]* ..?*
aa bb cc .aa .bb .cc ..aa ..bb ..cc
But if one of the types doesn't exist, the asterisk will stay:
$ rm ..?*
$ echo * .[!.]* ..?*
aa bb cc .aa .bb .cc ..?*
We need to avoid arguments that contain an asterisk to workaround this issue.