Linux: How to remove folders that are not empty? Delete directories recursively?

There is a Linux shell command to remove a directory: rmdir.
rmdir /path/to/nameOfDirectory
However, it will not remove directories that have not be emptied already.

You can remove a directory that still has files and subdirectories, but it is a little dangerous.
So, be careful when you use the rm command in this manner.
rm -rf /path/to/filenameYouWantToDelete
The -r option means to do it recursively (referring to the hierarchical content inside of subdirectories).

The -f option means to "force" or ignore nonexistent files, without prompts.

No comments :

Post a Comment