About to remove an empty directory? Use rmdir
, not rm -rf
. rmdir
will not remove the directory if it’s not empty. Make it a habit. Thank me once every 2 to 20 years when you don’t remove your stuff by accident.
About to remove an empty directory? Use rmdir
, not rm -rf
. rmdir
will not remove the directory if it’s not empty. Make it a habit. Thank me once every 2 to 20 years when you don’t remove your stuff by accident.
i use find first, to find out what im deleting. there are many times when you want to use rm -rf that it would be better to use find and autocreate a script to rm each file.
thats assuming the subfolders are made by people. if its just a source folder you unpacked and youre done playing with it, there are lots of folders you probably dont need to worry about and you can rm -rf them carefully. that said, people who do “convenient” things in the shell sometimes learn the hard way to read twice before hitting enter, 5 times if youre tired, 10 times if you just woke up.
LikeLiked by 1 person
Your “find” approach sounds good and actually is specific case of using non-destructive command first, like in the well-known suggestion to use SELECT first and only then DELETE with same WHERE clause.
LikeLiked by 1 person