How to delete files in file explorer

You should periodically delete any files or folders you don’t need to conserve space on your hard drive. Deleting a file in Windows is easy. Just select the file and press the Delete key on your keyboard. You will get an alert window asking you to confirm that you really want to delete the file.

How to delete files in file explorer

Once you click on Yes, the file will be moved to the Recycle Bin (you can also delete a file by dragging it to the Recycle Bin from any open window). If you want to delete the file or folder without getting a confirmation prompt from Windows, you can hold down the Shift key on your keyboard while you press the Delete key.

Once a file is in the Recycle Bin it is not automatically deleted from your hard drive. In order to permanently delete the files in the Recycle Bin, right click on it and select Empty Trash. This will delete all the files in your Recycle Bin at once.

How to delete files in file explorer

If you change your mind after you have deleted a file, you can still get it back from the Recycle Bin. First, open the Recycle Bin by double-clicking on it, then select the files you want to move out of it, and select Restore this item from the task list on the left. This will restore the file to its original location on the hard drive.

How to delete files in file explorer

Updated: 02/07/2022 by

How to delete files in file explorer

Now and then, it is a good idea to clean up your drives and delete duplicate photos, documents, temporary files, shortcuts, videos, or other unneeded or unused files or folders. The steps to delete a computer file, directory, or folder vary on the method you want to use and your operating system. To proceed, choose from the list of options below and follow the instructions.

How to delete files in Microsoft Windows

Microsoft Windows users can delete an unwanted file or folder (directory) from a hard drive or external disk drive using many different methods. Below are the more common methods for deleting a file or folder in Microsoft Windows.

Note

Users not familiar with Windows should realize that if you delete a folder or directory, all files and folders in that folder or directory are deleted.

Delete key

Locate the item you want to delete, highlight it by left-clicking the file or folder with your mouse once, and press the Delete key. You can browse the location of the file or folder using My Computer or Windows Explorer.

Tip

You can delete multiple files or folders by holding down the Ctrl key and clicking each file or folder before pressing Delete.

Tip

You can hold down the Shift key while pressing the Delete key to prevent files from going to the Recycle Bin when deleted.

How to delete files in file explorer

Delete file or folder by right-clicking

Open My Computer or Windows Explorer. We recommend you make sure the directory or folder is empty before proceeding, unless you intend to delete everything in it. Locate the file or folder you want to delete and right-click it. Choose the Delete option from the pop-up menu.

How to delete from the local disk

Important

The local disk contains files and folders that are imperative for your computer to run correctly. Unless you know what you are deleting, please do not delete any files from this section.

Open My Computer or Windows Explorer. On the left side of the screen, click This PC. On the right side of the screen, locate and double-click the local disk (usually C: or D:). Double-click the folder containing the file you want to delete. Select the file or folder you want to delete, click File in the top menu bar, and select Delete.

How to delete from an external drive

To delete from a USB flash drive, floppy drive, memory card, or external hard drive, open My Computer or Windows Explorer. On the left side of the screen, click This PC. On the right side of the screen, locate and double-click the drive, which is labeled as USB, flash drive, external hard drive, or the manufacturer's name. Select the file or folder you want to delete, click File in the top menu bar, and select Delete.

Delete from the file menu

Open My Computer or Windows Explorer. Locate and select the file or folder you want to delete, click File in the top menu bar, and select Delete.

Tip

If the File menu is not visible in My Computer or Windows Explorer, press the Alt key to make the menu bar visible, including the file menu.

Problems during delete

Some documents and folders may be protected from deletion through encryption or password protection. In this case, you may be asked for a password to decrypt or remove the password protection.

A file may be set as read-only, meaning the user can only open it for viewing and not modify or delete it. When trying to delete a read-only file, you get a message stating the file is write-protected and cannot be deleted. You need to modify or write permissions to delete the file.

Some files may only be deleted with administrator permissions. To delete these files, you would need to have administrator rights on the computer. If you are using a work computer, the technical support staff often are the only users with administrator rights on the computer.

Another possible cause of problems with deleting a file or folder is a virus or malware infection. Viruses and malware can prevent files or folders from being modified or deleted. If this is the case, you need to remove the virus or malware infection to delete the affected file or folder.

  • Unable to delete file: being used by another person or program.
  • How to remove a virus and malware from my computer.

Windows command line

See the MS-DOS and Windows command line section below for information about deleting a file or folder at the Windows command line.

Uninstalling a program

See our uninstalling a program steps for help with uninstalling (deleting) software programs from the computer.

  • How to uninstall software in Windows.

How to restore a deleted file or folder

If you've deleted a file by mistake, you can see our page on how to restore a deleted file for further information on recovering a deleted file.

  • How to recover missing, lost, or deleted files.

How to delete files in MS-DOS and the Windows command line

Note

Keep in mind that any deleted file or directory in MS-DOS is not sent to the Windows Recycle Bin.

Before you follow any of the steps below, you must get to an MS-DOS prompt or the Windows command line. If you are new to the command line, you may also want to read through the following pages first.

  • How to get to an MS-DOS prompt or Windows command line.
  • How to use the Windows command line (DOS).
How to delete files in file explorer

Files

MS-DOS users can delete files using the del command. See this page to get additional information and help with this command. Below is an example of how to use this command.

del example.txt

As seen in the example above, when deleting a file, you need to enter the full file name, including the file extension.

Tip

The del command can delete any file.

Delete multiple files

You can also use wildcards to delete multiple files or a group of files, as shown in the example below.

del *.txt

In the example above, this command would delete all text files that end with a .txt file extension.

Tip

The del command can delete any file extension.

Directory

MS-DOS users can delete directories (dir) in MS-DOS using the deltree command or rmdir command. See either of these links for additional information about these commands. Below is an example of how to use this.

rmdir example

Note

If the directory is full or has other subdirectories, you get an error message. To delete a full directory, you need to use a switch with the above example. For example, "rmdir example /s" to remove a full "example" directory. See our deltree command or rmdir command for additional examples and switches.

  • How to delete files in MS-DOS without a prompt.

Deleting a subdirectory

To delete a subdirectory, subfolder, folder within a folder, or directory within a directory, use a command similar to the example below.

rmdir example\test

In the example above, the "test" directory in the "example" directory is deleted. You could also use the cd command to change the directory to the example directory and then delete the "test" directory using our first example shown above.

How to delete a directory or file name with a space

To delete a directory or file name with a space in the name, you must surround the directory or file name with quotes, as shown below.

del "my example file.txt"
rmdir "my example directory"

In the above examples, we are deleting the file named "my example file.txt" with quotes surrounding the complete file name and extension and removing the "my example directory" directory.

Tip

The rmdir command can delete any file.

  • How to use the Windows command line (DOS).

How to delete files in Linux, Unix, and other variants

How to delete files in file explorer

Files

Linux and Unix users can delete files through the console using the rm command. See this page for additional information about this command. Below is an example of how to use this command.

rm example.txt

As seen in the example above, when deleting a file, you need to enter the full file name, including the file extension.

Tip

The rm command can delete any file.

Delete multiple files

You can also use wildcards if you want to delete multiple files, as shown in the example below.

rm *.txt

In the example above, this command would delete all files with a .txt file extension.

Tip

The rm command can delete any file of file extensions.

Directory

Linux and Unix users can delete folders through the console with the rmdir command. See this page for additional information about this command. Below is an example of how to use this command.

rmdir example

Tip

Like Microsoft Windows, with Linux and Unix, you can also delete files through the GUI by locating the file and pressing the delete key on the keyboard.

Deleting a subdirectory

To delete a directory in another directory (subdirectory), use a command similar to the example below.

rmdir example\test

In the example above, the "test" directory in the "example" directory would be deleted. You could also use the cd command to change the directory to the example directory and then delete the "test" directory using our first example shown above.

How to delete a directory or file name with a space

To delete a directory or file name with a space in the name, you must surround the directory or file name with quotes, as shown below.

rm "my example file.txt"
rmdir "my example directory"

In the examples above, we are deleting the file named "my example file.txt" with quotes surrounding the complete file name and extension. We are also removing the "my example directory" directory.

Tip

The rmdir command can delete any file.

  • How to remove a full directory in Linux.
  • Linux and Unix shell tutorial.

How to delete files on macOS

Apple macOS users can delete photos, documents, or other files or folders (directory) on their Mac using many different methods. Below are the more common methods for deleting a file or folder.

Note

Users not familiar with Apple macOS should realize that it deletes all the files in a folder if you delete that folder.

Delete key

The delete key on the keyboard by itself does not delete a file or folder on macOS. To delete a file or folder, press and hold Command, then press the delete key. You can browse to the location of the file or folder using Finder.

Right-click and choosing Move to Trash

Open Finder, locate the file or folder you want to delete, and right-click the file or folder. In the right-click menu that appears, click the Move to Trash option.

Delete from the file menu

Open Finder, locate and select the file or folder you want to delete. Click File in the top menu bar and select Move to Trash.

Terminal

To delete files or directories in the Terminal command line, use the rm command.

How to delete files on Microsoft Windows 3.X

File Manager

  1. Open File Manager
  2. Locate the folder or file you want to delete, then click File and Delete.

MS-DOS

See the MS-DOS user section above for information about deleting a directory in MS-DOS.

Why can't I delete a file in File Explorer?

It's most likely because another program is currently trying to use the file. This can occur even if you don't see any programs running. When a file is open by another app or process, Windows 11/10 puts the file into a locked state, and you can't delete, modify, or move it to another location.

How do I permanently delete files from File Explorer?

Click Delete in the File Explorer Ribbon at the top of the window, or click the arrow underneath the Delete option and select Permanently delete. Clicking Delete sends the file to the Recycle Bin, while selecting the Permanently delete option deletes the file for good.

How do I delete a folder in File Explorer?

Delete file or folder by right-clicking Open My Computer or Windows Explorer. We recommend you make sure the directory or folder is empty before proceeding, unless you intend to delete everything in it. Locate the file or folder you want to delete and right-click it. Choose the Delete option from the pop-up menu.

How do I delete multiple files in File Explorer?

You may select multiple files using shift or control keys..
Shift will select a contiguous block of files: click on any part of the first file except for the name, which will open it. ... .
Control will allow you to select individual files: hold down the control key and click on each file you want to delete..