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

RHEL: Install MySQL

[tuyendq@DangQuocTuyen ~]$ sudo yum list mysql Loaded plugins: product-id, search-disabled-repos, subscription-manager Error: No matching Packages to list [tuyendq@DangQuocTuyen ~]$ sudo yum install mysql Loaded plugins: product-id, search-disabled-repos, subscription-manager Resolving Dependencies --> Running transaction check ---> Package mariadb.x86_64 1:5.5.60-1.el7_5 will be installed --> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.60-1.el7_5 for package: 1:mariadb-5.5.60-1.el7_5.x86_64 --> Running transaction check ---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================= Package Arch Version Repository Size ================================...

Who is logged on to Windows

query user Check who is logged on to Windows: query user In Linux: who

Free eBook: HTML5 Programming Cookbook

Download link:  HTML5 Programming Cookbook