24.9 C
Texas
Melhttp://www.osradar.com
Guru Unix /Linux and GNU supporter

How to delete files and folders from CMD in Windows 10

Hi, how are you? Windows was born with the purpose of providing users with a graphical interface when using the computer. In fact, in the old DOS or MS-DOS systems everything was controlled by commands. However, Windows came with an intuitive graphical interface that took advantage of the use of a new peripheral known as the mouse. Currently, all users use Windows with a mouse and navigate through files and folders using the file explorer. On the other hand, it is still possible to do it classically with the CMD. Consequently, we will see how to delete files and folders from CMD in Windows 10.

Use CMD to delete folders and files

The idea of a terminal is traditionally associated with Linux operating systems. However, Windows also has its own terminal inherited from MS-DOS. This is known as Command Prompt. You will probably have used the PING command to check internet connectivity or cd to go to the hard drive directories. However, we will see how to delete folders and files using the CMD. Although it is more comfortable to use the graphical interface, it is always convenient to have this method. Because, sometimes the search button is broken. With this in mind we will use the DEL command. Next, please use the CD command to enter the directory. The syntax is as follows:

 DEL /F /A file.extension

Please remember to replace the file name with its respective extension. To enter the cmd, just press the Win+Q combination and type CMD.

Run a CMD
Run a CMD
Delete a file with the DEL command
Delete a file with the DEL command
- Advertisement -

The /F switch allows you to force the file to be deleted. While the /A allows to delete only the files marked as ready for archiving by Windows.

How to delete folders with CMD

To delete folders, the process is similar to that of deleting files. However, the change is to use the RD command. Similarly, use the CD command to enter the directory where the folder to be deleted is located. To delete folders, the process is similar to that of deleting files. However, the change is to use the RD command. Similarly, use the CD command to enter the directory where the folder to be deleted is located. The syntax is as follows:

 RD /S folder

Please remember to replace folder with the name of the folder to be deleted.

Delete a folder using the RD command.
Delete a folder using the RD command.

The /S parameter indicates that we will also delete all subfolders within the folder. If it is not used and there is a folder inside, it will not delete the main folder.

What to do if there is an error message that prevents you from deleting the folder

It is likely that when you use the DEl or RD command, the system will throw an error message that prevents you from doing the task. This usually happens because of a permission problem. Specifically, when you try to delete a folder you don’t own. Or when trying to delete a system folder. In those cases, CMD will not allow you to delete the folder or file. To solve this problem, just open CMD with administrator privileges:

Runs a CMD with administrator privileges
Runs a CMD with administrator privileges

In this way, it is possible to delete any type of folder or file. The exception is if you try to delete a protected system file.

Conclusion

In the final analysis, we saw how to delete files and folders from the CMD in Windows 10. If you like to manage your computer with the terminal, then this is your option. Before saying goodbye, I invite you to our post about an alternative dock for Windows 10. Bye!

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article