cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dmistry
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
v-litu-msft
Community Support
Community Support

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
Resident Rockstar
Resident Rockstar

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.

v-litu-msft
Community Support
Community Support

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

v-litu-msft
Community Support
Community Support

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
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!

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,208)