cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gary111
Regular Visitor

Change file path OneDrive or SharePoint

I am hoping some can help me figure out a problem.  

 

Assuming I have two paths:

Root>Read>User1, User2, User3 etc.

and

Root>Write>User1, User2, User3, etc.

 

When a new file is created in Root>write or one of its subfolders, how do I move or change the path from write>user1 to read>user1?

 

Thanks,

Gary

1 ACCEPTED SOLUTION

Accepted Solutions
v-LilyW-msft
Community Support
Community Support

Hi @Gary111 

Do you want to move file to Read folder or one of its subfolders when a new file is created in Write folder or one of its subfolders?

If yes, I set up a flow you can refer to with the following screenshots.

vLilyWmsft_0-1631685069081.pngvLilyWmsft_1-1631685079909.png

Flow in details:

vLilyWmsft_2-1631685137382.png

vLilyWmsft_3-1631685161113.png

Expression:last(split(outputs('Compose'),'root:'))

vLilyWmsft_4-1631685191177.png

Expression:split(outputs('Compose_2'),'/')

vLilyWmsft_5-1631685234676.png

Expression:length(outputs('Compose_3'))

vLilyWmsft_6-1631685268865.png

If the length is equal to 3, it means that a new file is created in the Write folder.

If the length is not equal to 3, it means that a new file is created in the Write's subfolder.

Expression:replace(outputs('Compose_2'),'Write','Read')

vLilyWmsft_7-1631685421050.png

Expression:replace(outputs('Compose_2'),'Write','Read')

vLilyWmsft_8-1631685460860.png

Then save and test.

When I upload a file in Write Folder, after flow runs, the file will be moved to Read folder.

vLilyWmsft_9-1631685569314.pngvLilyWmsft_10-1631685621933.png

When I upload a file in Write>User1 folder, after flow runs the file will be moved to Read>User1 folder

vLilyWmsft_11-1631685733274.pngvLilyWmsft_12-1631685756995.png

Hope the content above may help you.

Best Regards

If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-LilyW-msft
Community Support
Community Support

Hi @Gary111 

Do you want to move file to Read folder or one of its subfolders when a new file is created in Write folder or one of its subfolders?

If yes, I set up a flow you can refer to with the following screenshots.

vLilyWmsft_0-1631685069081.pngvLilyWmsft_1-1631685079909.png

Flow in details:

vLilyWmsft_2-1631685137382.png

vLilyWmsft_3-1631685161113.png

Expression:last(split(outputs('Compose'),'root:'))

vLilyWmsft_4-1631685191177.png

Expression:split(outputs('Compose_2'),'/')

vLilyWmsft_5-1631685234676.png

Expression:length(outputs('Compose_3'))

vLilyWmsft_6-1631685268865.png

If the length is equal to 3, it means that a new file is created in the Write folder.

If the length is not equal to 3, it means that a new file is created in the Write's subfolder.

Expression:replace(outputs('Compose_2'),'Write','Read')

vLilyWmsft_7-1631685421050.png

Expression:replace(outputs('Compose_2'),'Write','Read')

vLilyWmsft_8-1631685460860.png

Then save and test.

When I upload a file in Write Folder, after flow runs, the file will be moved to Read folder.

vLilyWmsft_9-1631685569314.pngvLilyWmsft_10-1631685621933.png

When I upload a file in Write>User1 folder, after flow runs the file will be moved to Read>User1 folder

vLilyWmsft_11-1631685733274.pngvLilyWmsft_12-1631685756995.png

Hope the content above may help you.

Best Regards

If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

Lily,

 

Thank you for working on this.  I am getting an error 


Unable to process template language expressions for action 'Condition' at line '1' and column '13699': 'The template language function 'length' expects its parameter to be an array or a string. The provided value is of type 'Integer'.

 

Gary111_0-1631731018518.png

 

I am guessing it is because I have a 'Test' folder between Root and Write

 

 

 

Gary111_1-1631731258224.png

Thank you,

Gary

 

Hi @Gary111 

This error indicates that there is a problem with your expression. Is your expression completely copied from what I provided? Please check your expression. 

If your Write and Read folder is stored in Test Folder, you just need to change 3 to 4 according to the solution I provided.

vLilyWmsft_0-1631779980027.png

Best Regards.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

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

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,136)