You need to use the rm command to remove files or directories (also known as folders) recursively. The rmdir command removes only empty directories. So you need to use rm command.
rm command syntax to delete directories recursively
The syntax is as follows:[donotprint][/donotprint]
rm -r dirName
OR
rm -r folderName
OR
rm -rf folderName In this example, recursively delete data folder: The specified /home/vivek/data/ will first be emptied of any subdirectories including their subdirectories and files and then data directory removed. The user is prompted for removal of any write-protected files in the directories unless the -f (force) option is given on command line: OR To remove a folder whose name starts with a -, for example '--dsaatia', use one of these commands: OR See Linux rm(1) command man page or rm command example page for more information.Examples
rm -r /home/vivek/data/
rm -rf dirname-here
rm -r -f /path/to/folder/
rm -rf -- --dsaatia
rm -rf ./--dsaatia
What is the significance of -r in the code ?
rm -r dirname
what is the difference in using -rf and -r ?
# rm -r dirName
on centos ask every file to be deleted
Thank you very much.
Thanks. Great article.
I have a question. How can I delete all subfolders /wp-content/cache/* in all folders in /home/ directory?