Move sharepoint files error "problem deleting folder.Folders that have subsites can't be deleted. "

john john Pter 1,345 Reputation points
2025-12-10T17:54:51.54+00:00

i am using power automate to get files only from a site then move those files to another site, but on some files i am getting this strange error:-

/sites/Operations-Archive/Documents/Information Technology/Board Portal/Board and Committee Portals/Investment Committee Page/Outside Manger Reports/2017*********{"status":400,"message":"There was a problem deleting folder \"/sites/Operations/Shared Documents/Information Technology/Board Portal/Board and Committee Portals/Investment Committee Page/Outside Manger Reports/2017\". Folders that have subsites can't be deleted. 

the error is saying that it can not delete folders although in my case i am only moving files?? and how can a folder has sub sites?

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-12-10T17:55:13.17+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error message you are encountering indicates that the folder you are trying to delete has subsites associated with it. In SharePoint, folders can contain subsites, and if a folder has any subsites, it cannot be deleted directly. This is likely why you are seeing the error even though you are only trying to move files.

    To resolve this issue, you can check if there are any subsites under the specified folder. If there are, you will need to delete those subsites first before attempting to delete the folder. Alternatively, you can move the files without deleting the folder, as the error suggests that the deletion is not permitted due to the presence of subsites.

    If you need to move files from a folder that has subsites, consider moving them to a different location without trying to delete the folder itself.

    0 comments No comments

  2. Matthew-P 7,370 Reputation points Microsoft External Staff Moderator
    2025-12-11T02:16:49.1+00:00

    Hi john john Pter

    Welcome to Microsoft Q&A Forum! Have a good day and I hope you're doing well! 

    I completely understand how frustrating and confusing it must feel when you’re only trying to move regular files, yet you end up with this error saying “Folders that have subsites can’t be deleted”, especially when you never intended to touch any folders at all! 

    Based on my research, here are some insights that might be useful. Even though you’re using the “Move file” action in Power Automate (and you only want to move files), behind the scenes SharePoint Online performs a Move operation in two steps: Copy the file to the destination site and delete the original file at the source and automatically delete any parent folders that become empty. 

    The problem occurs in step 2. When Power Automate tries to clean up the now-empty parent folders, it encounters a special folder that isn’t really a normal folder at all. In modern SharePoint Online, when someone creates a new Team Site or Communication Site and chooses “Use the same permissions as parent site” (or uses certain older templates), Microsoft mounts that entire child site directly into the parent site’s Shared Documents library, making it appear exactly like a regular folder. 

    From SharePoint’s perspective, that “folder” is actually a full site (with its own Site Pages, permissions, navigation, lists, etc.). Because of that, SharePoint strictly protects it and will never allow it to be deleted via regular API calls. This is exactly why you’re seeing the error “Folders that have subsites can’t be deleted”. 

    In your specific path, it’s very likely that one of the folders higher up in the chain is in fact a modern Communication Site or Team Site that was created this way and is being displayed as a folder. 

    Instead of using the built-in “Move file” (SharePoint) action, please switch to two separate actions: 

    1. Copy file (SharePoint) > copies the file to the destination site 

    2. Delete file (SharePoint) > deletes only the individual file at the source (it will not attempt to delete any folders) 

    This approach completely avoids the automatic folder-cleanup behavior, so the subsite-in-disguise error will no longer occur. 

    I hope the information I’ve provided helps clarify things and gives you some useful insights. If you have any concerns, questions, or if anything seems unclear, please feel free to reach out. 


    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.  


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.