Use Powershell to Delete File

Using PowerShell commnads to delete a file

Example


    # Using PowerShell commnads to delete a file
    Remove-Item -Path "C:\test\FirstCreateFile.txt"
    

Copy and Try it


You can also use wildcard '*' characters to remove multiple items. For example, this command removes all the files in C:\test:

Example


# Using PowerShell commnads to delete all file
Remove-Item -Path "C:\test\*.*"
 

Copy and Try it


Here also you can use -Force command to delete files force fully

Example


# Using PowerShell commnads to delete all file force fully
Remove-Item -Path "C:\test\*.*" -Force
 

Copy and Try it


Here also ypou can use -Force command to delete files force fully

Example


# Using PowerShell commnads to delete all file and folders
Remove-Item -Path "C:\test\*.*" -recurse

Copy and Try it

Delete-SharePoint-Files-With-PowerShell