web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Duplicate files & folders
Power Automate
Unanswered

Duplicate files & folders

(1) ShareShare
ReportReport
Posted on by 6

Hello PA Community,

 

New Power Automate user here.

I have tried searching online and on this forum for any advice and guidance in creating a flow to detect duplicate files and delete them from a determined file location such as an external drive, (eventually in a SharePoint document library). There are a lot of tutorials out there that refer to SP lists and records but I am struggling to find anything that is specific to files and folders.  

 

I believe there will be a need for a little more sophistication and wondered if any other users have solved this before and if anyone could point me in the right direction to other solutions.

 

For any file type (.jpg; .xlxs; .pdf etc). How might PA:

  • search a given location (external drive, SharePoint document library)
  • analyze for duplicate files by name
    • In this example, that would just catch files that are named the same, how would it capture files that were already copied and have the (1), (2), (3) following its name.
    • If it finds duplicate names, provide comparison data such as file size, date created, file location (perhaps) to help further determine if its a true duplicate and not just a duplicate by name.
    • Move or delete the duplicated file(s) to another location either for review or deletion

I am looking for a little guidance in a good practice for this analysis.

 

Thanks in advance for any help.

A

 

 

 

I have the same question (0)
  • GanCW Profile Picture
    237 on at

    I think this task is better acomplished using a batch script.

    You can google stackoverflow. https://stackoverflow.com/questions/41616534/batch-script-to-remove-duplicate-files

     

    Something like this 

     

  • DementedJay Profile Picture
    2 on at

    I'd be interested in this as well. 

  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

    This works. But I'm also worried about performance for large collection of files

     

    Folder.GetFiles Folder: $'''C:\\Users\\duplicatesseeker\\Desktop\\loc1''' FileFilter: $'''*''' IncludeSubfolders: True FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files1
    Folder.GetFiles Folder: $'''C:\\Users\\duplicatesseeker\\Desktop\\loc2''' FileFilter: $'''*''' IncludeSubfolders: True FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files2
    LOOP FOREACH File1 IN Files1
    LOOP FOREACH File2 IN Files2
    IF (File1.Name = File2.Name AND File1.Size = File2.Size) = $'''True''' THEN
    Display.ShowMessageDialog.ShowMessage Message: $'''DUPLICATE!!! BURN IT!!!''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    END
    END
    END

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 953

#2
Valantis Profile Picture

Valantis 810

#3
Haque Profile Picture

Haque 622

Last 30 days Overall leaderboard