-1

I am trying to make a bash install script. One of the tasks it has to do is to remove a certain full directory if it is present. I tried rmdir [location of directory] but it gives an error saying the directory is "not empty, so not removed". I couldn't find anything online about it. That is, I read some articles with no success. How can I make it remove the directory properly?

1 Answers1

1

rmdir only works if the given directory is empty. Directly from the rmdir man page:

"The rmdir utility removes the directory entry specified by each directory argument, provided it is empty."

You should probably be using:

$ rm -rf your_directory

The -r essentially means to recursively remove all files and dirs.

The -f means to remove files without prompting you and ignores file permissions.

Zach Tuttle
  • 141
  • 3