Windows “rmdir” Recursively

Windows operating systems provide the rmdir command in order to delete directories or folders. By default, the rmdir command deletes empty directories or folders. The rmdir command can also delete files and directories recursively. In this tutorial, we examine different ways to delete or remove directories recursively.

rmdir Recusrively

The rmdir command has the /s option in order to delete directories and folders recursively. In the following example we delete the directory named db This deletes the db and all child directories and files recursively.

> rmdir /s db

rmdir Recursively By Prompting

Deleting recursively is a very practical implementation but in some cases deleting all files and folders can create some problems. Some directories can be required and should not be deleted even if all others should be deleted. The deletion of the directories recursively can be done by approving every delete by prompting. The /q is used to delete directories recursively by prompting.

> rmdir /s /q db

rmdir Recursively Full Path

The rmdir can be used to delete directories recursively The directory can be specified as full path rather than the directory name.

> rmdir /s C:\Files\DB

Leave a Comment