CMD Delete Folder | Remove Directory Using CMD in Windows
The CMD command to delete folders in Windows 10 is
RD command also works the same way.
However, if the folder is not empty, Windows will throw an error:
To force delete a folder that is not empty and all of its subdirectories, add the
/s option to the
rmdir /s data
rmdir command prompts for confirmation before removing the folder. To delete a folder without prompt, add
/q option to the
rmdir /s /q data
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
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.