Skip to main content

Powershell: Remove-Item

Delete files and folders with Remove-Item
Use Remove-Item to delete files, folders, and more than that
PS C:\Users\commandovm> get-help Remove-Item

NAME
Remove-Item

SYNOPSIS
Deletes files and folders.

SYNTAX
Remove-Item [-Confirm] [-Credential <PSCredential>] [-Exclude <String[]>] [-Filter <String>] [-Force] [-Include <String[]>] -LiteralPath <String[]> [-Recurse] [-Stream <String[]>] [-UseTransaction] [-WhatIf] [<CommonParameters>]


Remove-Item [-Path] <String[]> [-Confirm] [-Credential <PSCredential>] [-Exclude <String[]>] [-Filter <String>] [-Force] [-Include <String[]>] [-Recurse] [-Stream <String[]>] [-UseTransaction] [-WhatIf] [<CommonParameters>]

Remove-Item [-Stream <string>] [<CommonParameters>]

DESCRIPTION
The Remove-Item cmdlet deletes one or more items. Because it is supported by many providers, it can delete many different types of items, including files, folders, registry keys, variables, aliases, and functions. In file system drives, the Remove-Item cmdlet deletes files and folders.

If you use the Stream dynamic parameter, it deletes the specified alternate data stream, but does not
delete the file.

Note: This custom cmdlet help file explains how the Remove-Item cmdlet works in a file system drive. For
information about the Remove-Item cmdlet in all drives, type "Get-Help Remove-Item -Path $null" or see
Remove-Item at http://go.microsoft.com/fwlink/?LinkID=113373.

RELATED LINKS
Online version: http://technet.microsoft.com/library/jj628241(v=wps.630).aspx
Remove-Item (generic); http://go.microsoft.com/fwlink/?LinkID=113373
FileSystem Provider
Clear-Content
Get-Content
Get-ChildItem
Get-Content
Get-Item
Remove-Item
Set-Content
Test-Path

REMARKS
To see the examples, type: "get-help Remove-Item -examples".
For more information, type: "get-help Remove-Item -detailed".
For technical information, type: "get-help Remove-Item -full".
For online help, type: "get-help Remove-Item -online"

Remove OneDrive folder (not empty)

PS C:\Users\commandovm> ri -Force .\OneDrive\

Confirm
The item at C:\Users\commandovm\OneDrive\ has children and the Recurse parameter was not specified. If you continue, all
children will be removed with the item. Are you sure you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): A
PS C:\Users\tuyen>

Popular posts from this blog

IIS: Delete cached files on server running IIS

Delete cached files on server running IIS When changing css, javascript files, check to delete if IIS still caches old files in the default folder C:\inetpub\temp\IIS Temporary Compressed Files\<sitename>\$^_gzip_D^\ Apply to: IIS 8.5

Linux command: du - disk usage

Where have all my storage gone? du summarize disk usage of the set of FILEs, recursively for directories.

ManageEngine ServiceDesk Plus - Reset password

Let's reset the default administrator's password to 'admin'