cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Km00
Helper II
Helper II

Compare newly create file in library to all current ones and move any old files with the same 'Standard_Name' metadata field to a new library

Hello!

 

I am trying to accomplish the following and i'm sure the answer is out there but i'm hoping you guys can help me.

 

I have a flow that is creating a file in a document library, what i need is to know if there is a duplicate file in that library (there is a metadata field called 'Standard_Name' that would be the same or just the file name being the same.  If the file name is the same, it won't overwrite, the flow just fails.

 

I was just going to have it append the date to the filename so it at least creates the file in the library BUT i still need to find that 'old' document and move it to a archive folder.

 

How to i find or compare the new file created in the library to all the other files 'Standard Name' field(would be the best way) and then move the old one to a new library. The 'compare' part is where i'm stuck at.

 

Let me know if you need more information.

 

Thank you!!!!!

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Km00 :

I suggest you add this step before creating the file:
1\Get all files in the target file directory (Not Include Nested Items)
2\ Traverse these files, find the file with the same name, and copy the file with the same name to the OLD folder
3\Delete files that have been copied
4\Create the files you need to create into the target directory
This will ensure that the file you create will not have the same name problem.For example:

1.JPG2.JPG

The function of these steps is to find the file with the specified name and move the file. After the file with the same name is moved, you can add new files.

In addition,this forum is the Power Apps forum, if you need more help with flow, I suggest you go to the Power Automate forum for help.

Best Regards,

Bof

View solution in original post

1 REPLY 1
v-bofeng-msft
Community Support
Community Support

Hi @Km00 :

I suggest you add this step before creating the file:
1\Get all files in the target file directory (Not Include Nested Items)
2\ Traverse these files, find the file with the same name, and copy the file with the same name to the OLD folder
3\Delete files that have been copied
4\Create the files you need to create into the target directory
This will ensure that the file you create will not have the same name problem.For example:

1.JPG2.JPG

The function of these steps is to find the file with the specified name and move the file. After the file with the same name is moved, you can add new files.

In addition,this forum is the Power Apps forum, if you need more help with flow, I suggest you go to the Power Automate forum for help.

Best Regards,

Bof

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (43,953)