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

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
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
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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

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