How to create and delete files and folders in Windows

Storing all the files (documents, images, videos, programs…) that we download or create on our computer in an orderly way will allow us to easily find the content when we need it and much faster than if we use a directory for everything.

If you want to learn how to create folders to organize all the files that you store, create and/or download on your device, in addition to learning how to manage them by moving them to other folders or even deleting them, in this article we will show you all the possible methods to organize your files digital.

create and delete files and folders in Windows

Create new folders in Windows

The fastest and easiest method to manage all the files and folders stored on your hard drive is to use the native file explorer, although it is not the only method available in Windows to manage files.

In addition to the file explorer, Windows also allows us to use the classic command line inherited from MS-DOS (CMD) and the PowerShell console interface with which we can interact with the operating system from the command line.

File Browser

We start with the fastest and easiest method to create folders, files and manage them. Unlike the methods that we also show you in this article, it is not necessary to use any command, since we are going to take advantage of the Windows graphical interface.

The first thing we need to do is open Windows Explorer. Regardless of the version of Windows you use, it is always represented by a folder. Clicking on the folder icon will display two panels. The drives and folders available on our computer are shown in the left section.

By clicking on each of the folders and drives, the content available inside will be displayed in the section on the right. To create a folder through Windows Explorer, the first thing we must do is go to the directory where we want to create it using both the left and right sections.

Next, once we are in the location where we want to create the folder, we go to the explorer ribbon, click on the Home tab and then click on New folder.

Crear carpetas Explorador archivos

If the New folder icon is gray and cannot be clicked, it means that we are in a location where we cannot create a folder. Another option, faster, is to place the mouse in the location where we want to create a folder, press the right mouse button and select the New > Folder option.

The process to delete a file or folder in Windows from File Explorer is exactly the same. The first thing we must do is select it with the mouse from the file explorer. If we are inside the directory that we want to delete, we must access the immediately previous location, since we cannot delete a directory from within.

Crear carpetas Windows con el ratón

Once we have selected the folder or file that we want to delete, we go to the explorer ribbon, click on the Home tab and then click on the Delete icon represented by a red X. Instead of clicking on the delete icon, we can click on the Delete key on our keyboard.

All the files and folders that we delete through the file explorer will be available for 30 days in the recycle bin, as long as we don’t have the habit of periodically deleting it because it annoys us to see it full of papers.

cmd

To use the Windows CMD (Command Prompt) command line to create directories, it is not necessary to access it with administrator permissions, we can run it like any other application.

Accessing the Windows command line is as simple as clicking on the Windows search box and typing CMD, clicking on the first result that is displayed (it is not necessary to run it with administrator permissions).

To move through the directories, we must know the basic commands: cd. . to go down a directory level, cd to access the root of the hard disk where we are and cd folder name to access the interior of a directory/folder. Using the dir command, a list of all the files found in the folder is displayed.

Once we are in the directory where we want to create a new folder, we write

md nombredelacarpeta

To access the interior of the directory, we use the command

cd nombredelacarpeta

PowerShell

Basically, through PowerShell we can use the same commands as CMD, since we can consider them practically the same, although PowerShell is aimed at creating system automations through scripts to use them in networks, a functionality that is not available with Command Prompt.

However, PowerShell also allows us to use specific commands to create and delete directories through unique cmdlets that are not available through Command Prompt.

To access PowerShell, we must access the Cortana search box and type PowerShell, clicking on the first result that is displayed (it is not necessary to run it with administrator permissions).

To create a directory using PowerShell we must enter the following command:

Crear carpetas Windows con PowerShell

New-Item -Path 'c:nombredelacarpeta' -ItemType Directory

Create new files

To create new files in Windows, the Microsoft operating system offers us different methods, methods that range from the graphical interface (the easiest and most comfortable method) to using the command line.

From Windows Explorer

To create files in Windows, unless we want to create automations or executable files that execute a series of commands on the command line, we need an application.

To create a text document, we need an application such as Microsoft Word, WordPad or Notepad (these last two are natively available in Windows).

If we want to create a presentation or a spreadsheet, we need, yes or yes, Excel and PowerPoint or the free versions of LibreOffice.

Crear archivos Windows

Once we have installed the necessary tools to create the type of file, the fastest and easiest method is to use the right mouse button. We just have to click on any part of the desktop or the folder where we want to create it with the right mouse button, click on New and select what type of file we want.

With the command line

Based on the fact that, to create a file, it is necessary to use the application according to the type of file we want, from the command line, we cannot create files of any type other than batch files that execute a series of actions that we have previously established.

If we want to create a text file, with a .txt extension, we must write the following command:

copy con nombredelarchivo.txt

crear archivos cmd

Next, we write the text that we want to include in the file. To close the document, press the key combination Control + Z and press the Enter key.

To create a text file with PowerShell, the command is different than CMD:

New-Item -Path 'C:nombredelarchivo.txt' -ItemType File

We can edit these files using the Windows Notepad app or the following command from PowerShell to open the file from Notepad.

notepad nombredelarchivo.txt

Delete files and folders

Just as there are different methods to create folders, if we want to delete files or folders, we also have different methods, both through the file explorer and using the command line with CMD or PowerShell.

Delete any file from explorer

The fastest method to delete any file that we have stored on our computer is using the mouse. We just have to click on it and then press the Delete key on the keyboard.

Another option, for those of you who like to use your mouse for everything, is to hover your mouse cursor over the file, press the right mouse button, and select the Delete option .

The last option that we have at our disposal to delete files in Windows from the graphical interface is to drag the file to the recycle bin.

If a file that we delete occupies more space than the recycle bin can store, Windows will inform us that the file will be deleted directly and cannot be recovered.

All the files that we delete using the file explorer will be available in the recycle bin for 30 days or until we empty it manually.

Delete files from CMD and PowerShell

To delete a specific file located in a folder, we must use the command:

del nombredelarchivo.ext

For example, if we want to delete the file softzone.docx, we must use the command

del softzone.docx

To delete all the files that are inside a directory, from the directory where the files are located we use the command

del *.*

borrar carpetas Windows CMD

And we confirm that we want to delete all the files in the folder.

If you use PowerShell instead of CMD, you can use the following command to delete a file.

Remove-Item -Path 'c:nombredelarchivo.ext' -Recurse

When deleting files, it is necessary to enter the full name of the file along with its extension. If we do not specify the extension, the system will not be able to identify the file.

While Windows uses the extension to associate a file with the application with which it can be opened, on the system, the extension allows the file to be located and interacted with.

All files deleted using Command Prompt or PowerShell cannot be recovered . When Windows introduced the Recycle Bin, it got rid of the undelete command, a command that allowed you to recover deleted system files.

Delete folders with explorer

The methods to delete folders in Windows from the Windows graphical interface using the explorer are the same that we have explained above to delete files.

Select the folder with the mouse and press the Delete button on the keyboard. Automatically, the folder will disappear from our view. Another method to delete folders is to place the mouse over the folder and pressing the right mouse button, select the Delete option to delete the folder.

If we drag the folder to the recycle bin, it will also be removed from our system. As with files, the folders that we delete will be available in the recycle bin for 30 days.

Delete folders from CMD and PowerShell

As I mentioned above, Command Prompt and Powershell share a series of commands, among which are those that allow us to create and delete folders.

Before deleting the contents of a folder, if we carry out this process using CMD, we must have deleted all the files that are inside it.

Next, we leave the directory where the file is located with the command:

cd..

and use the following command to remove the directory.

rd nombredelacarpeta

Through PowerShell, it is not necessary to delete the files that are in a directory before deleting it without the system asking us if we really want to carry out that process, using the command:

Remove-Item -Path 'c:nombredelacarpeta' -Recurse

Whether we use Command Prompt or PowerShell to delete folders, you must bear in mind that you will not be able to recover the content without resorting to data recovery applications.

Delete a very large folder in seconds

When we want to delete a large number of files, files that take up a large part of our hard drive, carrying out the process from Windows can take a lot of time.

The simplest solution is to use the command line from the directory where the files we want to delete are located and use the del command with the following parameters:

del /f/q/s *.* >nul

  • /F off deletion of read-only files.
  • /Q enables silent mode. It will not ask us whether or not to delete the files.
  • /S executes the command on all files in any folder under the selected path.
  • *.* removes all files.
  • >NUL disables console output. This improves the process and makes it faster by reducing the time by about a quarter.

The /f parameter forces the system to remove all files contained in the directory, including those marked by the system as read-only. We include the /q parameter so that it asks us if we really want to carry out the process (if we are doing it, obviously we are aware of it). The /s parameter includes each and every directory found in the folder.

Use the *.* command as explained above, only delete the files, not the included directories. Adding /s to the command makes sure to remove the directories as well.

Finally, access the directory above where the directory containing the files we have deleted is located and use the following command to delete the directory.

rmdir /s/qc:/nombredelacarpeta

  • /Q enables silent mode. He won’t ask us what to do.
  • /S executes the operation on all folders in the selected path.
  • Folder name: the absolute path. For example: o:backup/test1

If you are not used to using Windows from the command line, you can create an executable file with a .bat extension to automate the task.

To create this file from the command line we write:

copy con delete.bat

Next, we paste the following text:

@ECHO OFF
ECHO Delete Folder: %CD%?
PAUSE
SET FOLDER=%CD%
CD /
DEL /F/Q/S “%FOLDER%” > NUL
RMDIR /Q/S “%FOLDER%”
EXIT

Finally, we press the combination of keys Control + Z and then the Enter key. From the file explorer, we move the created file to the Windows folder so that it is accessible from the Windows registry.

To integrate this little one into the Windows registry and show it as an option in the context menu, we must perform the following steps:

In the Windows search box we search for and run the regedit.exe application. We go to the folder HKEY_CLASSES_ROOT / Directory / Shell

We place the mouse in the Shell directory, and with the right mouse button we select New > Key . The name of the new key will be Fast Delete (we can put whatever we want that allows us to quickly identify the function).

Now we place the mouse again on the name we have created, press the right button and select New > Key. We use the name Command .

In the right column, double click on Default and type

cmd /c "cd %1 && delete.bat"