CMD Delete Folder | Remove Directory Using CMD in Windows

cmd delete folder - delete directory cmd

The CMD command to delete folders in Windows 10 is rmdir. The RD command also works the same way.

rmdir YourFolder

However, if the folder is not empty, Windows will throw an error:

The directory is not empty

To force delete a folder that is not empty and all of its subdirectories, add the /s option to the rmdir command:

rmdir /s data

The rmdir command prompts for confirmation before removing the folder. To delete a folder without prompt, add /q option to the rmdir command:

rmdir /s /q data

The rmdir command allows user to remove multiple directories at once:

rmdir /s /q C:\Users\admin\Documents\dir1 C:\Users\admin\Documents\dir2

Note that both RD and rmdir commands delete directories permanently without moving to the Recycle Bin.

Also, you can’t delete the current working directory or if the folder you want to delete is currently being used by another process, the following error will be returned: The process cannot access the file because it is being used by another process.