You can use the Remove-Item cmdlet in PowerShell to delete specific folders and files.
Occasionally, when using the Remove-Item cmdlet you may be prompted by PowerShell to confirm that you actually want to delete specific items.
To bypass this confirmation, you can use the -Confirm:$false argument as follows:
Remove-Item c:/users/bobbi/current_data -Recurse -Force -Confirm:$false
This particular example will delete the folder named current_data along with all files inside the folder without being prompted to confirm that you want to delete these items.
The following example shows how to use this syntax in practice.
Example: How to Use Remove-Item and Skip Confirmation in PowerShell
Suppose that we have a folder with the following location:
- c:\users\bobbi\current_data
We can type ls to list out all files in this folder:

We can see that there are seven total files in this folder.
Suppose that we would like to delete this folder, including all of the files within it.
Suppose we use the following syntax to do so:
Remove-Item c:/users/bobbi/current_data
The following screenshot shows how to use this syntax in practice:

Notice that we are prompted by PowerShell to confirm that we would indeed like to delete this specific folder along with all of the files inside of it.
To delete this specific folder and avoid this prompt entirely, we can use the following syntax:
Remove-Item c:/users/bobbi/current_data -Recurse -Force -Confirm:$false
The following screenshot shows how to use this syntax in practice:

Notice that we aren’t prompted to confirm that we would like to delete this specific folder and its contents.
We can verify that the folder has been deleted by attempting to use the ls command again to view the contents of the folder:

We receive an error message stating that the path cannot be found. This confirms that we have successfully deleted the folder and its contents.
Note: You can find the complete documentation for the Remove-Item cmdlet in PowerShell here.
Related Tutorials
The following tutorials explain how to perform other common tasks in PowerShell:
PowerShell: How to Delete File if it Exists
PowerShell: How to Delete All Files with Specific Extension
PowerShell: How to Delete Files Matching a Certain Pattern
