Delete a Folder or File using Command Prompt (CMD)

Delete a Folder or File using Command Prompt: To create or delete a folder on your device you can simply right-click on the desktop and choose the desired options. Isn’t it easy? Yes, it is a very easy process but sometimes this method doesn’t work, or you can face some problems. So that’s why you don’t need to rely on one single method. You can always use the Command Prompt (CMD) to create a new folder or file and delete folders or files. In this guide, we will discuss all the possible methods to create or delete files & folders. 

If you are not able to delete some files or folders and you see a Windows warning message then don’t worry, you can easily delete such folders or files using the Command Prompt. Therefore, learning to use Command Prompt to perform certain tasks is always helpful. We will discuss all the ways via which Microsoft users can create & delete files or folders.

Note: If you delete a folder, then it will also delete all its contents & files. Therefore, you need to keep this in mind that once you delete a folder using Command Prompt, you will delete all the files present within the selected folder.

Delete Key

One of the easiest ways to delete a folder or file is to select the particular folder or file and then press the Delete button your keypad. You just need to locate the particular file or folder on your device. If you want to delete multiple files & folders then you need to press & hold the Ctrl key and select all the files or folders which you need to delete. Once done, then again press the Delete button on your keyboard.

Delete folders or files with right-click option 

You can select the file or folder that you want to delete and right-click on that file or folder and choose the delete option from the right-click context menu.

Contents

How to Delete a Folder or File using Command Prompt

Make sure to create a restore point just in case something goes wrong.

While deleting, creating, or opening any file or folder using the Command Prompt, you need to make sure that you use the right command to get your task done. Hopefully, you will find all the below-mentioned methods helpful.

Method 1: How to delete files or folders in MS-DOS Command Prompt

Note: You need to open a Command prompt or Windows PowerShell with admin access on your device. 

1.Open Elevated Command Prompt using any one of the methods mentioned here.

2.Now type the following command into the Command Prompt and hit Enter:

Del example.txt

3.You need to enter the full path (location) of the file and file name with its extension to delete that file.

For example, I deleted sample.docx file from my device. To delete I entered “del sample.docx” without quotation marks.  But first, I need to navigate to the said file location using the cd command.

How to delete a folder or directory using the Command Prompt

1.Again open Elevated Command Prompt using any one of the methods mentioned here.

2.Now you need to enter the below-mentioned command into cmd and hit Enter: 

rmdir /s

3.If your folder path has spaces, then you need to use quotation marks for the path. 

rmdir /s “C:\Users\suraj\Desktop\test folder”

4.Let’s take an example for illustration purpose: I have created a test folder in my D drive. To delete that folder I need to enter the below command:

rmdir /s d: \testfolder\

You need to type the drive name where your folder is saved and then type the name of the said folder. Once you type the above command and hit Enter, your folder and all of its content will be deleted permanently from your PC without leaving any trace on your device.

Now that you have learned how to delete a folder or file using Command Prompt (CMD), do you wish to continue to learn more thing that you can do with the Command Prompt?  Well, if you are interested then in the next part we will talk about how to create a folder, open any folder and file using the Command Prompt. 

Method 2: How to create a Folder using the Command Prompt

1.Open Elevated Command Prompt using any one of the methods mentioned here.

2.Now type the following command into the Command Prompt and hit Enter:

MD drive_letter\folder name\

Note: Here you need to replace drive_letter with the actual drive letter where you want to create the said folder. And also, you need to replace the folder name with the actual name of the folder which you wish to use.

3.In the above example, I have created a testfolder in the D: drive of my PC and for that, I have used the command:

MD D: \testfolder\

Here you can change the drive and folder name according to your drive preferences and folder name. Now you can check whether the command successfully executed or not by going to the drive where you have created the folder. As in my case, I have created the folder in the D: drive. Below image shows that the folder is created under D: drive on my system.

If you want to open a particular folder on your device, you can do it using the Command Prompt as well.

1.Open the Command Prompt and type the below-given command in the cmd:

start drive_name: \folder name

Note: Here you need to replace drive_letter with the actual drive letter where your folder which you wish to open reside. And also, you need to replace the folder name with the actual name of the folder which you wish to use.

2.In the above example, I have opened the same folder (testfolder) that I created in the above step and for that, I have used the command:

start D: \testfolder\

Once you will hit the enter button, the folder will immediately open on your screen without a delay. Hurray!

Delete a folder with the Command Prompt

Although we have already discussed how to delete a folder with Command Prompt but in this method, we will use another command. This command is also equally useful to delete a folder on your device.

1.Open Elevated Command Prompt using any one of the methods mentioned here.

2.Now type the following command into the Command Prompt and hit Enter:

Rd drive_name: \folder name\

3.For example, I deleted the same folder which we created above, testfolder. For that, I use the following command:

Rd D: \testfolder\

Once you hit Enter, the above folder (testfolder) will be deleted immediately from your system. This folder will be permanently deleted from your system and cannot be recovered. Once deleted, you will not find it in the Recycle bin to restore. Therefore, you need to be sure while deleting any files or folders with Command Prompt as you won’t be able to recover the data once deleted.

Recommended:

I hope this article was helpful and now you can easily Delete a Folder or File using Command Prompt (CMD), but if you still have any questions regarding this tutorial then feel free to ask them in the comment’s section.

Sign up and earn $1000 a day ⋙

Exploring the Features of IP Anonymizer Database

Exploring the Features of IP Anonymizer Database

In an era where online privacy and data protection have become paramount concerns for individuals and organizations alike, the need for effective tools to safeguard personal information is more critical than ever. The IP Anonymizer Database emerges as a vital resource for those seeking to navigate the complexities of digital anonymity.

TOP AI tools help you add color to old black and white photos

TOP AI tools help you add color to old black and white photos

TOP AI tools help you add color to old black and white photos. If you want to add color to old black & white photos, use one of the AI ​​tools below.

7 rules for storing a bank card

7 rules for storing a bank card

Each bank card is marked with important information - number, owner’s name, expiration date, CVC or CVV and a chip, thanks to which payments are made at terminals (including contactless). In order for this information to be preserved, it is important to treat the means of payment with care.

IObit Malware Fighter 11 Review 2024

IObit Malware Fighter 11 Review 2024

When your computer gets attacked by a virus or malware, you’ll certainly such for a powerful antivirus to fight back. Well, IObit Malware Fighter is exactly what you need. From its name alone, you can be certain that you are getting the tough protection your computer needs.

How To Find Quality And Fast Internet In Montreal

How To Find Quality And Fast Internet In Montreal

Montreal, a city brimming with culture, history, and Poutine (a famous Canadian dish), deserves an internet connection that can keep up. Whether you’re a streamer glued to Twitch, a workaholic juggling video conferences, or a casual web surfer, a reliable and fast internet plan is essential.

Google Drive for desktop will be discontinued in March 2018

Google Drive for desktop will be discontinued in March 2018

Google Drive for desktop will be discontinued in March 2018, Google has officially announced that it will stop supporting Google Drive for desktop and then the company will remove the application.

Simple ways to fix AirDrop not working error

Simple ways to fix AirDrop not working error

Simple ways to fix AirDrop not working error, AirDrop not working on iPhone, iPad, Mac what to do? This article will provide you with simple ways

TOP best computer screen recording software 2024

TOP best computer screen recording software 2024

TOP best computer screen recording software 2024, Which is the best lightweight, free, high-quality computer screen recording software? Let's find out the top with WebTech360

What is an email address? How to get an email address?

What is an email address? How to get an email address?

What is an email address? How to get an email address?, What is an email address? What is email address entry? This article will answer all your related questions

Every WhatsApp shortcut for computer you need to know

Every WhatsApp shortcut for computer you need to know

Every WhatsApp shortcut for your computer you need to know, WhatsApp is one of the most popular free messaging apps today. The keyboard shortcuts below will help

Unlocking Baccarats Social Thrills: Tedbets Global Gaming Hub

Unlocking Baccarats Social Thrills: Tedbets Global Gaming Hub

Discover the vibrant social scene of baccarat on Tedbet, where players worldwide connect, chat, and enjoy the excitement of live dealer games.

Summary of how to find videos on TikTok

Summary of how to find videos on TikTok

Summary of how to find videos on TikTok, Finding videos on TikTok is not difficult. Let's learn together how to find the original video on TikTok or find the Tik Tok clip you want to watch

Improved mouse sensitivity for Free Fire on BlueStacks

Improved mouse sensitivity for Free Fire on BlueStacks

Improved mouse sensitivity for Free Fire on BlueStacks, BlueStacks has made important improvements for Free Fire gamers. Please upgrade BlueStacks 4.230.10

Huang you: Butter Camera sparkling photo editing app

Huang you: Butter Camera sparkling photo editing app

Huang you: Sparkling photo editing application Butter Camera, Huang you (黄油 相机) is an extremely hot Chinese editing application today, here we would like to invite you

Tips for using Chrome Web Store you need to know

Tips for using Chrome Web Store you need to know

Tips for using Chrome Web Store you need to know, Chrome Web Store or Chrome Web Store offers a selection of apps, extensions and stylish browser wallpapers

What is CapCut? Is it safe to use CapCut?

What is CapCut? Is it safe to use CapCut?

What is CapCut? Is it safe to use CapCut?, What is CapCut? Is music on CapCut copyrighted? Let's find out with WebTech360 what you need to know about CapCut!

Why is buying TikTok coins cheaper on PC?

Why is buying TikTok coins cheaper on PC?

Why is it cheaper to buy TikTok coins on PC?, TikTok gives users the option to exchange real money for coins in the app. However, buying TikTok coins on PC is cheap

How much Internet capacity does Zoom use?

How much Internet capacity does Zoom use?

How much Internet capacity does Zoom use?, Zoom is an indispensable remote online learning and working software during the epidemic, but it can be extremely bandwidth-consuming.

EmuOS: Relive your childhood with legendary games of the past

EmuOS: Relive your childhood with legendary games of the past

EmuOS: Relive your childhood with legendary games of the past, EmuOS is a Web interface that simulates basic Windows 3.1, 95, 98, NT operating systems that provide a lot

TOP best ways to open and read PDF files on your computer

TOP best ways to open and read PDF files on your computer

TOP best ways to open and read PDF files on your computer. How to open PDF files on your computer is not too difficult. In fact, you have many ways to read PDF files. Join WebTech360