Creating Mass Sharepoint Subfolders In One Go

Jason Levy 106 Reputation points
2021-03-08T01:41:19.403+00:00

Hi there,

We have a alot of client folders in our Sharepoint Document Library that will require us to input a 2021 folder within them, instead of doing this manually for each one (over 100) is there a script that can be run or some better way of doing it?

Thx

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,682 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,810 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,016 Reputation points
    2021-03-08T06:30:15.86+00:00

    Hello @Jason Levy ,

    You could use PnP powershell to achieve this, below is my example script for your reference:

    $siteURL="https://tenant.sharepoint.com/sites/test"  
    $library="/Shared Documents"  
    Connect-PnPOnline -Url $siteURL  
      
    $folderColl=Get-PnPFolderItem -FolderSiteRelativeUrl $library -ItemType Folder  
    foreach($folder in $folderColl){  
    	$folderUrl=$library+"/"+$folder.name  
    	Add-PnPFolder -Name "2021" -Folder $folderUrl  
    }  
    

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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.