Solved Delete hidden files?

Hello,

Sorry for the dumb question, but in linux I can type
[cmd=]rm -r \.*[/cmd]
to delete hidden files recursively, but I get
Code:
rm: "." and ".." may not be removed
when doing the same in freeBSD.

I was wondering how I can delete hidden files (using a wildcard) in freeBSD?

Thanks in advance,
-bg
 
Tested in small tmp dir, this seam to work (however you better double check it, just to make sure, you don't delete any other files, since it's late hare... and I'm sleepy)
$ rm -vR \.*
 
Its ok, "." and ".." are special links to current dir and parennt dir and may not be removed =)
Other hidden files will be removed
 
Be careful % rm -r .* will also remove all files in the current directory.

Use something like % rm -r .[^.]* to remove all hidden files.
 
SirDice said:
Be careful % rm -r .* will also remove all files in the current directory.
No, dot isn't a wildcard in this context.
Use something like % rm -r .[^.]* to remove all hidden files.
Not as complete, but easier to remember and usually sufficient:
rm -r .??*
 
jalla said:
Not as complete, but easier to remember and usually sufficient:
rm -r .??*
True, but it won't remove dotfiles that only have one character like .a ;)
 
No. ? means "any 1 character", so the very minimum file name size that .??* will select is 3: . + any 1 character + any 1 character + 0 or more characters.

The ? means that there must be a character there.
 
killasmurf86 said:
Tested in small tmp dir, this seam to work (however you better double check it, just to make sure, you don't delete any other files, since it's late hare... and I'm sleepy)
$ rm -vR \.*

^^^^
 
Back
Top