cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

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
Highlighted
Community Support
Community Support

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
Highlighted
Super User II
Super User II

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.

Highlighted
Community Support
Community Support

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

Highlighted
Community Support
Community Support

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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (998)