cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
dmistry
Level 8

Trigger a flow when a file is added to file system folder and copying it to Sp2019 Library with renamed version

Hi,

 

I am looking for a solution to get the below behavior implemented via flow. 

We have a file share where bunch of documents arrive in a folder called Legal. Users work on a file and they save it as let's say for example 'General Access Management 2019', pdf or word mostly. Then they send it to external party for review.

 

Then after, users receive the file with corrections with file name be 'General Access Management 2019_V1', now when this happens, users manually rename the file and save it to sharepoint so it can add up as a new version to the earlier saved file in sharepoint. So if possible, I would like to automate this process. The review process can occur more than one time, hence external party might send over files with '_V2','V3','V4' appended at the end of file name.

 

So basically whenever a new file arrives to the file system folder, I want to take that and rename by stripping off the portion '_V1' or '_V2' or 'V3' or 'V4' and then save it to SharePoint so it can be added as a new version to the existing file in sharepoint. Can someone please help me with the solution, thanks in advance. 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Trigger a flow when a file is added to file system folder and copying it to Sp2019 Library with renamed version

Hi @dmistry,

 

You could use the split() function to process the file name.

Please follow these steps and expression:

Annotation 2019-09-23 151311.png

Get file name without V1, split it use "_V", then get an array, the array[0] is the file name:

 

split(body('Create_file')?['Name'],'_V')[0]

 

 

Get file extension, split it use '.', the array[1] is the extension:

split(body('Create_file')?['Name'],'.')[1]

 

Result:Annotation 2019-09-23 151640.png

After creating the file without V1, you can create a Delete file action to delete the file that name with "V1".

Best Regards,
Community Support Team _ Lin Tu
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

3 REPLIES 3
Gristy
Level 10

Re: Trigger a flow when a file is added to file system folder and copying it to Sp2019 Library with renamed version

Hey,

 

You could probally do a PowerShell script to get files with a certain name

 

Get-Childitem –Path C:\ -Include *_V* -File -Recurse -ErrorAction SilentlyContinue

 

You could use something like this to upload to SharePoint: https://blog.salamandersoft.co.uk/index.php/2011/01/using-powershell-to-bulk-upload-files-to-sharepo...

 

I suspect you would need to strip the last 3 characters of the filename first so that the file names match i.e. remove _V1.

 

It is going to be messy though - you might be better moving the staff to SharePoint and you could even just sync the library for each user.

Community Support Team
Community Support Team

Re: Trigger a flow when a file is added to file system folder and copying it to Sp2019 Library with renamed version

Hi @dmistry,

 

You could use the split() function to process the file name.

Please follow these steps and expression:

Annotation 2019-09-23 151311.png

Get file name without V1, split it use "_V", then get an array, the array[0] is the file name:

 

split(body('Create_file')?['Name'],'_V')[0]

 

 

Get file extension, split it use '.', the array[1] is the extension:

split(body('Create_file')?['Name'],'.')[1]

 

Result:Annotation 2019-09-23 151640.png

After creating the file without V1, you can create a Delete file action to delete the file that name with "V1".

Best Regards,
Community Support Team _ Lin Tu
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

Community Support Team
Community Support Team

Re: Trigger a flow when a file is added to file system folder and copying it to Sp2019 Library with renamed version

Hi @dmistry,

 

Has your problem been solved?
If your problem has been solved, You could go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

Best Regards,
Community Support Team _ Lin Tu

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 162 members 4,714 guests
Please welcome our newest community members: