cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Automate moving files in Sharepoint

I am in the process of creating a flow that will take files from one folder (outside of SP) and then modify the file name to add information (date/year). 

That changes, so I will probably either do that manually or update the flow before running. 

Once that step is done I am needing to move the file into a specific folder in SP, and that is where I am running into issues. 

one issue I am running into is that the file needs to go into the child folder, not the parent folder. (Folder: Account, subfolder: reports

Another issue is that the file is being moved into a folder based on the file name, aka. the file is called "Customer name_type of report_timeframe" and the file goes into the "Customer name" folder. 

 

This is what I have so far: 

create file.JPG

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can use Create file action instead of Copy file action, there is a reference you can take:

Step1: Create trigger When a file is created in a folder, then you need to create a condition to determine the filename of the file created whether equal to utcNow('yyyy-MM'), in case the flow will run stock in an infinite loop.

Step2: Create two composes split the file name with extension:

File Name Without Extension:

split(triggerOutputs()['headers']['x-ms-file-name'],'.')[0]

File Extension:

split(triggerOutputs()['headers']['x-ms-file-name'],'.')[1]

Step3: Use Create file action instead of Copy file action. The issue that the file needs to go into the child folder, not the parent folder, also could be solved. 

 

Folder: /subfolder/"Output of File Name Without Extension"

File name: "File Name Without Extension"_"utcNow('yyyy-MM')"."File Extension"

File content: File content from trigger.

Annotation 2019-07-19 160513.pngAnnotation 2019-07-19 160554.png

Please have a try, I hope it helps you.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
efialttes
Super User
Super User

@Anonymous 

If I understood properly, this post can help you.

Hopo this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



v-bacao-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can use Create file action instead of Copy file action, there is a reference you can take:

Step1: Create trigger When a file is created in a folder, then you need to create a condition to determine the filename of the file created whether equal to utcNow('yyyy-MM'), in case the flow will run stock in an infinite loop.

Step2: Create two composes split the file name with extension:

File Name Without Extension:

split(triggerOutputs()['headers']['x-ms-file-name'],'.')[0]

File Extension:

split(triggerOutputs()['headers']['x-ms-file-name'],'.')[1]

Step3: Use Create file action instead of Copy file action. The issue that the file needs to go into the child folder, not the parent folder, also could be solved. 

 

Folder: /subfolder/"Output of File Name Without Extension"

File name: "File Name Without Extension"_"utcNow('yyyy-MM')"."File Extension"

File content: File content from trigger.

Annotation 2019-07-19 160513.pngAnnotation 2019-07-19 160554.png

Please have a try, I hope it helps you.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Anonymous
Not applicable

Both of these are good solutions but I would like to use a manually trigger for my flow- is there a way to do that? 

Hi @Anonymous ,

 

If you add manually trigger to execute the flow, you can create Get files Action to get the files from the library then add the same operations previous reply, but could not get the specified folder.

 

Do you want to change the file that did not add time in filename before? If you want to manually customize file name through flow, it is more convenient to change the flow name directly.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you- I was able to use a combination of the two solutions to move the files. Unfortunately, the file names were not consistent so they were unable to go into the right folder- they just ended up in shared documents. 

I am going to try and bump the split against a SharePoint list and see if that will work. 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,457)