0

I have a sharepoint folder where I accidentally dropped a folder with a many subdirectories and files. I would like to delete it all by deleting the top level folder, however I keep getting an error since the folder is full of files.

You have to delete all the items in this folder before you can delete this folder.

Is there any way to force delete the folder even though it contains many files?

  • can you tell us what technology are you using? Full Rest, CSOM, JSOM, Client Object... – Marco Apr 18 at 15:51
  • I really don’t know. We have a Microsoft 365 office sharepoint folder. I interact with it via the web interface. – Sledge Apr 18 at 16:36
1

If you or your admin knows PowerShell, you can use the SharePoint PNP library to delete the folder:

#if not already installed
#install-module sharepointpnppowershellonline   #requires PS 4.0 or later.

Connect-PnPOnline -Url https://yourServer/sites/yourSite
Remove-PnPFolder -name Test -Folder "/shared documents"  

 

You may see recommendations to use the SharePoint "Sync" feature. Don't. This is a real overkill for just deleting a single folder, and opens up some interesting risks to other site data.

 

You can use Windows Explorer and map the library to a drive letter. You then display the library in Windows Explorer, click the folder and click Delete. (The items will be sent to the recycle bin.)

Windows Explorer can be very finicky and works for some and not others. You may need to logon to the site with Internet Explorer first. Do a web search with your windows version, browser version and error message for help.

Basic steps:

  • Open Windows Explorer
  • Right-click the Network folder/icon
  • Click Map Network Drive
  • Click "Connect to a Web site that you can use to store your documents and pictures"
  • Click "Choose a custom location" and click Next.
  • Enter the URL to your library. (Just the library, not a view: https://yourServer/sites/yourSite/Shared Documents)
  • Click Next and enter a name and then click Finish.
  • Windows Explorer should open with your library displayed.
  • Delete the folder
  • Should also add that I am using a Mac, so not sure if these solutions will work for me. Still good ideas and I'll try to find the Mac equivalent. – Sledge Apr 18 at 18:30
  • There is a PowerShell for Mac, but I don't think the PNP cmdlets will work there. Can you login to your SharePoint from a Mac, or enlist the help of someone in IT? – Mike Smith - MCT - MVP Apr 18 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.