Here are tips to troubleshoot the issue:
1.Check whether previously deleted files are still open in the browser and locally.
2.Access the document library by using an owner account to check whether has draft files in the folder.
3.In the document library, at the bottom left, click Return to Classic SharePoint, then try to delete the folder.
4.In the classic document library, open the document library in the file explorer, then try to delete the folder.
5.Use following PowerShell to delete the folder.
Import-Module Microsoft.Online.SharePoint.Powershell -DisableNameChecking
#Variables for Processing
$SiteUrl = "https://tenant.sharepoint.com/sites/emilytest"
$FolderURL="/sites/emilytest/Shared Documents/folder" #ServerRelativeURL
Try {
#Get Credentials to connect
$Cred = Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$Ctx.Credentials = $Credentials
$Web = $Ctx.Web
#Get the folder object from given URL
$Folder=$web.GetFolderByServerRelativeUrl($FolderURL)
#sharepoint online powershell delete folder in document library
$Folder.DeleteObject()
$Ctx.ExecuteQuery()
Write-host "Folder deleted Successfully!" -ForegroundColor Green
}
Catch {
write-host -f Red "Error deleting Folder!" $_.Exception.Message
}
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.