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.

View solution in original post

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,728)