undo rm -rf *

Bruno Wolff III bruno at wolff.to
Tue Mar 26 16:42:48 UTC 2013


On Tue, Mar 26, 2013 at 17:21:28 +0100,
   Reindl Harald <h.reindl at thelounge.net> wrote:
>
>and how yoill you remove all hidden files of a folder?

For cases where I just want dot files/dirs removed I use '.??*'. That 
only hits names at least three characters long.

>this is safe since a very long time
>
>[root at testserver:/tmp]$ LANG=c; /usr/bin/rm -rf .*
>/usr/bin/rm: cannot remove directory: '.'
>/usr/bin/rm: cannot remove directory: '..'

That's an improvement. I hadn't tested doing an rm -rf of .. for about 10 
years. That version of rm starting decsending .. before doing any check for 
whether .. should be removed.


More information about the users mailing list