In an age when everything was controlled by commands and systems such as DOS (or MS-DOS), Windows had a much more intuitive graphical interface designed to take advantage of the use of a totally new peripheral: the mouse.
Today we all use Windows with the mouse and navigate through our files and folders using File Explorer. However, it is also possible to do it the old classic way, using CMD.
Although when we talk about terminal we generally associate it with Linux, even Windows has its own “terminal” inherited from MS-DOS, the well-known Command Prompt, or simply CMD.
Users who want to use the operating system the old way can use the CMD to execute certain commands on the system and perform basic tasks. If you have used it at least once, I’m sure the first commands will have been ping, to see if we have internet connectivity, cd to browse the directories on our hard drive, and dir to show a list of all the files and folders in said directory.
Perhaps not everyone knows that it is possible for the Windows command prompt to delete files. Very useful for very large files.
When we are going to delete large folders in Windows, the thing we notice is that this process takes a long time to complete. This process can take 10, 20 minutes, or even longer to delete a large folder.
If instead, we delete a folder via the command line, we will see that it takes much less time and the operation will be completed faster.
If we want to know more about CMD commands, today we will show you how to delete files and folders from CMD.
How to delete files and folders from CMD
Command Prompt is a Windows interface that allows you to perform all kinds of tasks on your computer using basic CMD commands. To access it, just go to the Windows menu and type CMD in the search bar.
Deleting files and folders from CMD is extremely useful to be able to get rid of all those files that require permissions to be deleted, or those that cannot be deleted because they are in use at that moment.
The first thing we need to do is open the command prompt and we will use the DEL (Delete) command with which we can delete any type of file from our hard drive. In the CMD panel, we will first use the CD command to go to the directory where the files and folders are hosted. For example: cd C: new folder test
Once there we will proceed to write the following code:
DEL / F / A <file.extension> (file name and its extension).
Parameters F and A will allow us to delete the files, where F allows to force the deletion of the file and A to delete the files marked as ready for archiving.
The process for deleting folders is quite similar to the previous one; however, this time we will have to change the command, and instead of using DEL we will have to use the RD (Remove Directory) command.
We will have to go back to the directory with the CD command, we will look for the folder we want to delete and we will have to execute this command:
RD / S <folder name>
It is very important to add the S parameter since with it we will delete all subfolders contained in the original folder. Without entering that command, if the folder you want to delete had a subfolder, it could not be deleted.
After carrying out this process, the interface will ask us if we are sure to make the changes (Y / N), we must press the S key to confirm and enter to delete the folder.