How do I delete a file, directory, or folder?

DeleteMicrosoft Windows users
MS-DOS and Windows command line users
Linux, Unix, and variant users
Microsoft Windows 3.X users

Microsoft Windows users

Microsoft Windows users can delete a folder different ways, below is a listing of the different methods to delete a folder.

Note: Users not familiar with Windows should realize that if you delete a folder, it will delete all the files and folders within that directory.

Tip: The steps below are for deleting a single file, but the same steps can be applied to delete multiple files if you highlight multiple files before performing any of the steps below.

Delete key

By far the easiest method of deleting files in Microsoft Windows is by locating the file, folder, shortcut, or other object you want to delete, highlight it by clicking the file once, and press the del or delete key on the keyboard. You can browse to the location of the file or folder using either My Computer or Windows Explorer.

Right-click delete a file in WindowsDelete file by right-clicking

Open My Computer or Windows Explorer, locate the file or folder you want to delete and right-click the file or folder you want to delete and click the delete option from the menu that appears after you have right-clicked the file or folder.

Delete from File menu

Open My Computer or Windows Explorer, locate the file or folder you want to delete, and click File from the drop down menu and then Delete.

Problems during delete

Windows command line

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

MS-DOS and Windows command line users

Note: Keep in mind that any deleted file or directory in MS-DOS will not be sent to the Windows Recycling Bin.

Before any of the steps below can be followed you must get to a prompt.

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 this command could be used.

del example.txt

As seen in the above example when deleting a file you need to enter the full filename including the file extension. You can also use wildcards if you want to delete multiple files.

Directory

MS-DOS users can delete directories 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 this could be used.

rmdir example

Linux, Unix, and variant users

Files

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

rm example.txt

As seen in the above example when deleting a file you need to enter the full filename including the file extension. You can also use wildcards if you want to delete multiple files.

Directory

Linux and Unix users can delete folders through the console by using the rmdir command. See this page for additional information about this command. Below is an example of how this command could be used.

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.

Microsoft Windows 3.X users

File Manager

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

MS-DOS

See the above MS-DOS users section for information about creating a directory in MS-DOS.

Additional information