Make life easy with PowerShell, following script will help you to delete all files and subfolders in One Go.
#Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser #Install-Module SharePointPnPPowerShellOnline #Config Variables $SiteURL = "https://mydomain.sharepoint.com/site" $ListName ="my_DocLib" $FolderServerRelativeURL = "/site/my_DocLib" Try { #Connect to PnP Online Connect-PnPOnline -Url $SiteURL -UseWebLogin #Get All Items from Folder in Batch $ListItems = Get-PnPListItem -List $ListName -FolderServerRelativeUrl $FolderServerRelativeURL -PageSize 2000 | Sort-Object ID -Descending #Powershell to delete all files from folder ForEach ($Item in $ListItems) { Remove-PnPListItem -List $ListName -Identity $Item.Id -Recycle -Force Write-host "Removed File:"$Item.FieldValues.FileRef } } Catch { write-host "Error: $($_.Exception.Message)" -foregroundcolor Red }
Your feedback is always appreciated. I will try to reply to your queries as soon as time allows.Please don't spam,spam comments will be deleted upon reviews.
No comments:
Post a Comment
Your feedback is always appreciated. I will try to reply to your queries as soon as time allows.Please don't spam,spam comments will be deleted upon reviews.