How to Remove a Non-Empty Directory in Linux
rmdir is the command used to remove an empty directory. This command does not remove a linux directory which still has contents in it. This helps prevent the user from accidentally deleting a file they did not want to remove.
Whan you do want to remove a directory and all of its contents, including files and subdirectories use the
rm -r DirectoryName
command, where DirecoryName is the name of the directory you are looking to remove. This will recursively remove the content of a linux directory.
If you have any write-protected files within the directory or its subdirectories you will be prompted to make sure that you wish to delete them. To avoid this prompting run the command
rm -rf DirectoryName
The -f flag will force the deletion of all files and directories.