Permanently Delete Folder From SharePoint Library Using PnP PowerShell

This blog shows the syntax and commands to permanently delete a specific folder from the SharePoint Library.

PnP PowerShell Syntax

Remove-PnPFolder -Folder <web relative parent folder url> -Name <folder name> 
 
The Remove-PnPFolder PowerShell command from PnP is used to delete the given folder permanently from the SharePoint library, even though the folder has multiple items.

The below PowerShell command deletes the folder A from the parent folder "Shared Documents/ParentFolder".
  1. Remove-PnPFolder -Folder "Shared Document/ParentFolder" -Name "Folder A"

  • Use the -Force parameter to forcibly delete the folder from the library.
  • If we want to delete the folder from subweb, use the -Web parameter with web URL.
Use the https://github.com/SharePoint/PnP-PowerShell link to get and install the PnP PowerShell module.