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

nmap - The Network Mapper

WARNING : It is ILLEGAL to scan hosts without permission.

VMware Workstation: vmrun.exe

Using vmrun.exe to manage VMs on VMware Workstation

Linux command: lspci

Linux command: lspci - list pci devices tuyendq@ubuntu001:~$ man lspci NAME        lspci - list all PCI devices SYNOPSIS        lspci [options] DESCRIPTION        lspci is a utility for displaying information about PCI buses in the system and devices connected to them.        By  default,  it  shows a brief list of devices. Use the options described below to request either a more verbose output or output intended for parsing by        other programs.        If you are going to report bugs in PCI device drivers or in lspci itself, please include output of "lspci -vvx" or even better  "lspci  -vvxxx"  (however,        see below for possible caveats).        Some  parts of the output, especially in the highly verbose modes, are probably intelligible only to experienced PCI hac...