cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
da1ve
Helper II
Helper II

Rename multiple SharePoint sub-folders

Hi all,

So i am trying to rename a bunch of SharePoint sub-folders that will follow a pattern. So the client has a site called Clients and in the default document library all the clients are listed. Now under each client folder there will be the financial year folders in the normal year format of 2016, 2017, 2018 etc...

If we were to change that format to something like FY16, FY17, FY18 etc... for all matching sub-folders across all those client folders but only within the client top level folder (no lower levels need to be changed).

Now some may have 2017-2022 and others may only have 2017-2018 and some may not have any of these folders at all

Would this scenario be possible in Flow using the SharePoint API?

Some examples of the folders:

 

da1ve_0-1656398939352.png

da1ve_2-1656398966693.png

 

Thanks,
David

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @da1ve ,

 

I was working on the flow to automatically lookup the folder names and rename them. Please see my test flow:

vjefferni_0-1656643321581.png

 

Detailed steps:

vjefferni_1-1656643330213.png

vjefferni_4-1656643656975.png

vjefferni_3-1656643414606.png

Filter query expressions as follows, FSObjType means IsFolder, substringof means contains in and FileLeafRef is folder name which you have already known:

 

FSObjType eq 1 and substringof('20',FileLeafRef)

 

 Expression in Compose operator:

 

concat('FY',slice(items('Apply_to_each_2')?['{Name}'],3,5))

 

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

2 REPLIES 2
da1ve
Helper II
Helper II

So I managed to figure this one out, this was the solution:

 

da1ve_0-1656627312818.png

 

Compose: 

CreateArray('Client 01','Client 02','Client 03')
 
HTTP request:
da1ve_1-1656627442861.png

 

I probably could have done a client folder lookup instead of manually entering them in the compose and also "variabled" the year and FY values....

v-jefferni
Community Support
Community Support

Hi @da1ve ,

 

I was working on the flow to automatically lookup the folder names and rename them. Please see my test flow:

vjefferni_0-1656643321581.png

 

Detailed steps:

vjefferni_1-1656643330213.png

vjefferni_4-1656643656975.png

vjefferni_3-1656643414606.png

Filter query expressions as follows, FSObjType means IsFolder, substringof means contains in and FileLeafRef is folder name which you have already known:

 

FSObjType eq 1 and substringof('20',FileLeafRef)

 

 Expression in Compose operator:

 

concat('FY',slice(items('Apply_to_each_2')?['{Name}'],3,5))

 

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,608)