2 thoughts on “Unix safety tip: use rmdir

  1. 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.

    Liked 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.

      Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s