rmdir Command in Linux/Unix with ExamplesThis command is used to delete a directory. But will not be able to delete a directory including a sub-directory. It means, a directory has to be empty to be deleted. Syntax: Example: For example, in the image below we have deleted directory 'file1' from 'envelope' successfully. Now we want to delete 'created' directory. But it shows error as it contain 'file2'. Hence, to delete 'created' directory, first we have to delete 'file2'. Then, we will be able to delete 'created' directory. rmdir -pThis command will delete a directory including its sub-directories all at once. In below picture, all sub-directories have been deleted with 'rmdir -p' command.
Next TopicRename Folder in Linux
|