undo rm -rf *

Reindl Harald h.reindl at thelounge.net
Tue Mar 26 16:21:28 UTC 2013



Am 26.03.2013 17:16, schrieb Bruno Wolff III:
> On Wed, Mar 27, 2013 at 03:11:54 +1100,
>   Celik <celik.n.00 at gmail.com> wrote:
>>
>> Bruno, after such an experience, did you come up with an alternative
>> solution to using "rm -rf"?
>> "rm -i" is good as it prompts before deletion however it becomes tedious if
>> there are a lot of files to be deleted, hence "rm -rf" seems ideal but
>> dangerous if not cautious :(
>> Had a look on google, there was one particular recommendation that caught
>> me attention (sorry I don't have the link). It was recommended to mv the
>> files (and/or folders) to be deleted into a tmp directory. I'm planning to
>> try that in my future code, we'll see how things go.
> 
> Try to be more careful, especially when there is an asterisk involved. And I keep in mind about '..', so no
> deleting '.*'

and how yoill you remove all hidden files of a folder?
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: '..'



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20130326/69b01ffd/attachment.sig>


More information about the users mailing list