To remove a directory that contains other files or directories, use the following command.
rm -r mydir
// or we can use this command
rmdir mydir
Executing the above command would delete all files and directories within the directory named in the command. However, it would also present a prompt for approval to delete each of the files. If you don't want to receive a prompt for each file, use the following command instead.
rm -rf mydir