Last week, while working on a project using Power Automate, I encountered a unique requirement: the need to rename specific folders across multiple directories within a SharePoint document library. Specifically, a subfolder named cp reports needed to be renamed to Corporate Reports. This situation arose in a library containing over 100 parent folders, each subfolder needing to be renamed.
In this tutorial, I will show you how to rename subfolders in a SharePoint document library using Power Automate. Also, we will see how to rename a SharePoint folder using Power Automate.
Rename Subfolders in a SharePoint Folder Using Power Automate
For this example, I created a SharePoint document library called Corporate Projects. This library has various folders, such as Financial Analysis, Marketing Campaigns, etc.
Each folder contains a subfolder called cp reports. Now, I want to rename the subfolder to Corporate Reports, which should affect all the folders inside the library. You can refer to the folder structure below:
Corporate Projects
->Financial Analysis
->cp reports
->Marketing Campaigns
->cp reports
->Product Development
->cp reports
->Project Management
->cp reports
->Sales Reports
->cp reports
Now follow the below steps:
1. In the Power Automate, click the Instant Cloud flow, enter the Flow name, and choose the trigger flow (i.e., manually trigger a flow).

2. Then add an Initialize variable action and provide the variable name, type it as a String, and in value, provide a new subfolder name Corporate Reports, write the below expression:

3. Add the Get files (properties only) action from the SharePoint connector, which retrieves all the files in the document library. Then, select the Site Address and Library Name from the drop-down menu.
Then expand the advanced parameters and provide the filter query below :
substringof('cp reports',FileLeafRef)You can change it according to the requirements.

4. Then add a Send an HTTP request to SharePoint action from sharePoint Connector with the below parameter: Related Power Automate articles:
- Site Address: Select the SharePoint site where you want to rename the subfolder name
- Method: Select “POST” as the method
- URI: Provide the below URI:
_api/web/GetFolderByServerRelativeUrl('Full Path')/ListItemAllFields- Headers: Add a key-value pair:
{
"Accept" : "application/json;odata=verbose",
"X-HTTP-Method" : "MERGE",
"If-Match" : "*"
}- Body: Provide the below JSON format:
{
"Title": "@{variables('varNewFolderName')}",
"FileLeafRef": "@{variables('varNewFolderName')}"
}
Now, click Save and run the flow manually. After it runs successfully, go to the SharePoint document library, and you will see that the subfolder name has changed.

You can rename the subfolder name in the SharePoint document library using Power Automae.
Rename a SharePoint Folder Using Power Automate
Suppose you have a SharePoint library called Certification Documents, where each folder is named after a certification document’s ID and issuance date (e.g., ISO9001 2023). When certifications expire, you want to rename these folders to mark them as Expired.
For example, if a folder name starts with ISO9001 and it’s now expired, Power Automate should rename it to Expired ISO9001 2023.

Now, I want to rename it as Expired ISO9001 2023. To do this, follow the below steps:
1. Go to Power Automate and create an Instant Cloud flow by using the trigger flow (i.e., manually trigger a flow).

2. Add the Get files (properties only) action and provide the below parameters:
- Site Address: The SharePoint site address from the drop-down menu.
- Library Name: Select the library name where your folder is present.
- Filter Query: provide the following:
substringof('ISO9001 2023',FileLeafRef)
3. Lastly, add a Send an HTTP request to SharePoint action from sharePoint Connector with the below parameter:
- Site Address: Select the SharePoint site where you want to rename the folder name
- Method: Select “POST” as the method
- URI: Provide the below URI:
_api/web/GetFolderByServerRelativeUrl('CertificationDocuments/ISO9001 2023')/ListItemAllFields- Headers: Add a key-value pair:
{
"Accept": "application/json;odata=verbose",
"X-HTTP-Method": "MERGE",
"If-Match": "*"
}- Body: Provide the below JSON format:
{
"Title": "Expired ISO9001 2023",
"FileLeafRef": "Expired ISO9001 2023"
}
Now, click Save and run the flow manually. After it runs successfully, go to the SharePoint document library, and you will see that the folder name has changed.

Conclusion
In this tutorial, I explained how to use Power Automate to rename folders and subfolders within a SharePoint document library. We covered two examples: renaming specific subfolders within multiple parent folders in a library and renaming folders based on specific criteria, such as marking expired certification folders.
Related Power Automate articles:
- Rename File in Power Automate
- Get Approval Comments Using Power Automate
- Get Days of Month in Power Automate
- Check the Condition If Blank in Power Automate
- Delete File From SharePoint Using Power Automate
- Get the Last & First Item ID from SharePoint List in Power Automate

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (12 times). I have also worked in companies like HP, TCS, KPIT, etc.