Rmdir command is used to remove or delete a folder on Windows, DOS, and Unix operating systems. It is important to note that the folder must be empty before using this command, and it can only be used from the previous level or a non-related directory.
Using Rmdir Command in Windows and DOS
In Windows and DOS, RMDIR and RD are two forms of the command. To remove a folder named “myfolder” in the current directory, you can use either of the following commands:
Using Rmdir Command in Unix
In Unix, only the RMDIR command works. To remove a folder named “myfolder” in the current directory, you can use the following command:
For instance, if you want to remove the “HARRY” subfolder within the “PEOPLE” folder, you can use the following command:
1. Can Rmdir command delete a non-empty folder?
No, Rmdir command can only delete an empty folder. If the folder contains any files or subfolders, you need to delete them first before using this command.
2. Is there any way to force Rmdir command to delete a non-empty folder?
Yes, you can use the “/S” switch with RMDIR command in Windows and DOS to delete a non-empty folder and all its contents. However, be careful while using this command as it will delete everything within the folder without confirmation.
Rmdir command is a useful tool for deleting empty folders in Windows, DOS, and Unix systems. However, you need to be cautious while using this command and ensure that the folder is empty before executing it.