Data SecurityWindows

Delete Files with Command Prompt and Command Line

The command prompt and command-line on the Windows computer can be regarded as a good helper, as well as a harmful tool. The “rm” command can help us remove the data files from the computer, and the “rmdir” command can help us erase the directories and the folders. But the difference between deleting data with the command line and with the trash bin is that: it is hard for us to get the deleted things back. So, it is noticeable that we use the command prompt and command-line with great caution.

Advantages of deleting files by command prompt and command line:

It is easy and simple to use the trash bin when we want to delete something. So why do people use the command prompt and command line? In fact, the command prompt and command line can be used with ease. Let’s see the main advantages of the command prompt and command line:

  • 1. With the help of the wildcards, we can remove the data files and the folders effectively.
  • 2. The data files in the trash bin can be recoverable.
  • 3. All the data files including the hidden ones can be seen, and you can, therefore, delete them too.
  • 4. The command prompt and command line can help you control the tools on your computer even if the operating system goes wrong.

Besides, here, you will learn more about empty the Recycle Bin, the best way to crack Windows 10 and how to fix Folder Access Denied easily.

The tutorial on how to delete files and folders on the Windows computer by using Command Prompt

Have you ever deleted any file or folder with the command prompt and command line? Do you know how to use this tool on the Windows computer? Let me walk you through this tutorial below:

Step 1. Launch the Command Prompt tool

Click on the “Start” menu on the toolbar of the desktop, and then go to “All Programs” > “Accessories” > “Command Prompt“. And there is another way to fulfill this goal by the “run dialog”. In the input blank of the “run dialog”, input “cmd” and then click on “OK“. Remember to omit the quotes, and please do so in the following passages.

Step 2. Type the command lines

First, input “del“. Then type the name of the file and the extension. If you have no idea what the extension is, just go to the file on your Windows and see what is on the search bar. If you are already in the directory of the file you want to delete, just go forward. If you are not in the directory, you can just input the word “cd” to complete the path of the file that you want to delete.

For example, if you want to delete a text file named “file.txt”, which is on the desktop, you can input something like this “C: /Users/username/Desktop\file.txt“.

Step 3. Use the asterisk

The DEL command supports the wildcards including the asterisk (*). For example, if you want to delete all the “WAV” files on your desktop, you can input the command line like this: “del C:\Users/username/Desktop/*.wav.

Step 4. Confirm the deleting process

After input what you want to delete, you can press the “ENTER” key on your keyboard to start the deleting process.

The tutorial on how to delete files and folders on the Mac computer by using Command line

Since you have seen how to delete the files on the Windows computer, it can be referred if you want to delete some files on your Mac computer. Also, here you will find out how to fix the directory name is invalid issue.

The tutorial on how to delete the directory with the rmdir command

It is impossible to delete the directory with the rm command just like the one I showed you above. But to fulfill this goal, you can use the rmdir command, which is a special command for deleting the directory. It is noticeable that if you delete the directory, the files in it will also be deleted with your operation. And this may cost you a long time.

The tutorial on how to delete directory

If you want to delete the directory, you can refer to the guidance below:

  • 1. Open the Archives tool. The tool you use to delete the directory is called the Archives.
  • 2. Remember if you delete the directory with this method, you will have no way to recover it again. So you must confirm that all the data files in this directory are unwanted.

The tutorial on how to use the rm-R command

The rm – R command is also useful if the trash bin in your Mac computer can’t be emptied. That is to say, the files on the trash bin are not permitted to be deleted. But luckily, there is another useful. Just read on, please.

  • 1. Open the rm-R tool on your computer.
  • 2. Type a space.
  • 3. Go to the trash bin on your computer and then drag the files that you want to delete to the Terminal Window. And then, you can see the command line like this: “/Users/.Trash/file.txt.“.
  • 4. After you confirm all the information on the Terminal Window, you can now press on the “ENTER” button to delete the files on the trash bin.

The tutorial on how to open the command prompt from a folder

Do you know, there is also a way to open the command prompt from a folder, which is a really time-saving method. What you need to do is to locate the folder you want, and then right-click on the folder. From the pop-up menu, choose the item of “open command window here“. And right after that, the command prompt will show up.

The tutorial on how to see the Command History

When you want to get access to the command lines that you inputted before, you can refer to this tutorial. You don’t have to input them all over again. Instead, you can use the command line of “Doskey/history“.

PS: Here, you can fix the AMD Quick Stream issue, bad system config info Windows 10, as well as your Windows license will expire soon with ease.

By the way, even if you, unfortunately, lost files on your PC, there is still a chance to recover them back. Here is the Best File Recovery Tool – Recoverit for you to get it back.

  • Recover deleted or lost photos, files, music, emails, videos from your computer or other storage safely, effectively, and completely.
  • Well support file recovery from recycle bin, hard drive, memory card, flash drive, digital camera, and camcorders.
  • With it, you are able to retrieve files for formatting, sudden deletion, hard drive corruption, system crash, virus attack under various situations.
  • You are allowed to preview and make a selective data recovery.
  • Well support for Windows Vista/XP/10/8/7, macOS 10.15 included

Get Recoverit

Related Articles

Back to top button