On Windows 11, you can use the del
command with the terminal to quickly delete a file or folder. However, you can’t use it to delete folders recursively since the tool is designed for files.
If you have to remove files and subfolders from a folder, you must use different tools. For example, you can use the rmdir
(remove directory) a tool with Command Prompt to delete folders recursively, or you can use the Remove-Item
cmdlet on PowerShell.
This guide will teach you two ways to quickly delete folders with Command Prompt and PowerShell subfolders.
Delete folders with subfolders with Command Prompt
To remove a subfolder from a folder with commands on Windows 11, use these steps:
-
Open Start on Windows 11.
-
Search for Command Prompt, right-click the top result, and select the Run as administrator option.
-
Type the following command to remove an empty folder and press Enter:
rmdir PATH\TO\FOLDER-NAME
In the command, replace PATH\TO\FOLDER-NAME with the folder path and the folder name to delete. This example removes the “files” folder:
rmdir C:\files
-
Type the following command to delete folders and subfolders with contents on Windows 11 and press Enter:
rmdir /s PATH\TO\FOLDER-NAME
This example removes the “files” folder, subfolders, and files:
rmdir /s C:\files
-
Type the following command to delete a folder with content recursively without a confirmation prompt and press Enter:
rmdir /s /q PATH\TO\FOLDER-NAME
This example removes the “files” folder, subfolders, and files without prompting for confirmation:
rmdir /s /q C:\files
Once you complete the steps, the command will remove a subfolder from a folder and files from Windows 11.
The /s
option deletes the folder and its content in the above command, but it prompts confirmation. The /q
option ignores the prompt and deletes the folder recursively.
Delete folders with subfolders on PowerShell
To recursively delete an entire folder (with subfolders) on PowerShell, use these steps:
-
Open Start.
-
Search for PowerShell, right-click the top result, and select the Run as administrator option.
-
Type the following command to delete an empty folder and press Enter:
Remove-Item PATH\TO\FOLDER-NAME
In the command, replace PATHTOFOLDER-NAME with the folder path and the folder name to delete. This example removes the “files” folder:
Remove-Item C:\files
-
Type the following command to delete a folder with subfolders on Windows 11 and press Enter:
Remove-Item -Recurse -Force PATH\TO\FOLDER-NAME
This example removes the “files” folder:
Remove-Item -Recurse -Force C:\files
After you complete the steps, the command will remove the folder and its contents with or without a prompt, depending on the command.
The -Recurse
option deletes the folder and its contents without prompt confirmation. The -Force
option erases special items, including read-only or hidden files, but it’s not required.