broot icon indicating copy to clipboard operation
broot copied to clipboard

Safer alternative to default rm -rf command

Open kvnvallis opened this issue 3 years ago • 9 comments

The default behavior of typing :rm or rm followed by Enter is concerning. If you have the wrong thing highlighted, like a folder full of important files, it will run rm -rf on that folder and delete everything in it without prompting you.

I changed my rm command to rm -i. May I suggest either not having a default rm command (like how the touch verb is commented out for creating new files) or choosing something safer? The standard rm shell command without any options would be fine. Being momentarily confused about not being able to delete a directory is better than accidentally deleting a whole tree.

This behavior was found in arch linux with broot version 1.19.0-1

kvnvallis avatar Jan 15 '23 05:01 kvnvallis

rm -r could be a thing I guess, but no rm -i would be just useless.

Stargateur avatar Jan 15 '23 11:01 Stargateur

You don't have to close this, even if I don't answer. I don't think the answer is in changing the command itself but I prefer the issue to stay visible so that people give their opinion. Maybe the solution would be in some kind of warning dialog on first execution, I don't know.

Canop avatar Jan 22 '23 20:01 Canop

Related: there's now a :trash internal, which may be used like this:

{
    invocation: "rm"
    internal: "trash"
    leave_broot: false
}

Canop avatar Jan 01 '24 14:01 Canop

I just tried it on windows. It works great!

kvnvallis avatar Jan 04 '24 09:01 kvnvallis