Managing folders in the Command Prompt (CMD) lets you quickly organise or clean up files without relying on the graphical interface. This guide explains how to create and delete folders using simple Windows commands.
Table of Contents
Why Create and Delete Folders Using the Command Prompt?
Using the Command Prompt offers several advantages over the graphical interface:
-
It is faster and more efficient for performing folder management tasks.
-
Allows automation through batch scripts for creating or deleting multiple folders at once.
-
Provides better access to hidden or system directories that may not be easily visible in File Explorer.
-
Enables remote management of files and folders where a graphical interface is not available.
-
Offers more control and precision, making it useful for system administrators and advanced users.
Prerequisites
Before proceeding, ensure you have:
- A Windows system (Windows 10, 11, or Server version).
- Basic knowledge of Command Prompt commands.
- Administrative privileges (for deleting protected folders).
Open Command Prompt
To open Command Prompt:
- Press ‘Windows + R’, type cmd in the Run dialogue box, and then press Enter.
- Alternatively, search for Command Prompt in the Start menu and click Run as administrator if required.
How to Create a Folder Using CMD?
- To create a new folder using the Command Prompt, use the mkdir (make directory) command followed by the folder name.
For example, typing the command:mkdir Projects
This command creates a new folder named “Projects” in the current directory.
- If you want to create a folder in a specific location, you can include the full path in the command. For example:
mkdir “C:\Users\Admin\Documents\New Folder”
This command creates a folder named “New Folder” inside the Documents directory of the admin user. Always use quotation marks if the folder name or path contains spaces to ensure the command runs correctly.
How to Delete a Folder Using CMD?
- To delete a folder using the Command Prompt, use the rmdir (remove directory) command followed by the folder name.
For example:rmdir Projects
This command deletes the “Projects” folder if it is empty.
- If you want to remove a folder along with all its files and subfolders, use the following command:
rmdir /s /q “C:\Users\Admin\Documents\OldProjects”
- In this command:
Caution: This action permanently deletes the folder and all its contents. Use this command carefully to avoid accidental data loss.
Common Examples
- To create a folder in the current directory, type:
mkdir MyFolder
This command makes a new folder named MyFolder.
- To create a folder in another drive, type:
mkdir D:\Work\Reports
This creates a folder named Reports inside the D:\Work directory.
- To delete an empty folder, type:
rmdir MyFolder
This removes the MyFolder directory if it’s empty.
- To delete a folder with all its files and subfolders, type:
rmdir /s /q D:\Work\Reports
Tips and Best Practices
- Use quotes for folder names with spaces (e.g., “New Folder”).
- Double-check paths before using /s /q to avoid deleting important data.
- Use the dir command to confirm the folder’s location before deleting it.
- For batch operations, you can combine multiple mkdir or rmdir commands in a .bat file.
For greater control and flexibility, consider using a Windows VPS Hosting solution with administrator access and dedicated resources.
Conclusion
Using the Command Prompt to create and delete folders gives you faster control over file management and automation. Whether you are organising project directories or cleaning up old data, these CMD commands make the process efficient and straightforward.
However, if you require additional assistance, feel free to contact our support team.
Want to know more about your system? Learn How to Find Your Windows Version Using Command Prompt