I feel like the main reason the distinction exists, is because deleting a whole directory can be potentially catastrophic.
I looked at Trashy yesterday, which gives you a command trash my_file that just moves the file into the trashcan folder. Well, and that decided to make no distinction between files and directories, which does make sense to me, since you can just restore a deleted directory.
My solution: rm will remove an empty directory, while a full directory will throw either an “are you sure? y/N” or require you to use rm -r. Why have a command whose only job is to remove an empty directory?
Yeah, I feel like a big part of the reason it was designed like that, is because it was designed in the 70s, where you couldn’t really throw up interactive prompts. But interactive prompts are also somewhat tricky for scripting, as it’s difficult to detect whether a user could respond to the prompt, meaning the script might just hang there forever.
That’s kind of the problem. You almost need separate tools for scripting and interactive use, but having separate tools is also not great, since people will inherently try to use the tool they know for everything…
I feel like the main reason the distinction exists, is because deleting a whole directory can be potentially catastrophic.
I looked at Trashy yesterday, which gives you a command
trash my_file
that just moves the file into the trashcan folder. Well, and that decided to make no distinction between files and directories, which does make sense to me, since you can just restore a deleted directory.My solution: rm will remove an empty directory, while a full directory will throw either an “are you sure? y/N” or require you to use rm -r. Why have a command whose only job is to remove an empty directory?
Yeah, I feel like a big part of the reason it was designed like that, is because it was designed in the 70s, where you couldn’t really throw up interactive prompts. But interactive prompts are also somewhat tricky for scripting, as it’s difficult to detect whether a user could respond to the prompt, meaning the script might just hang there forever.
That’s kind of the problem. You almost need separate tools for scripting and interactive use, but having separate tools is also not great, since people will inherently try to use the tool they know for everything…