INFORMATICS

The Best

Powershell - Delete File

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

Use Powershell to Delete File

Using PowerShell commnads to delete a file


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


You can also use wildcard '*' characters to remove multiple items.

For example, this command removes all the files in C:\test:with .txt extension.


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


Here also you can use -Force command to delete all files from directory -Force


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


Here also you can use -Force command to delete all files and folders -recurse


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

Search