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 / subtract lists - compa...
Power Automate
Answered

subtract lists - comparing two lists with file names

(0) ShareShare
ReportReport
Posted on by 41

Hello,

This seems like an easy task. I have two zip files that I've extracted into two different folders. I want to compare the contents to see what files are in the first zip, but not the second.

 

The "Get Files in Folder" action saves the FULL PATH of the File + file name into a list variable named CurrentZipFiles.

The "Get Files in Folder" action saves the FULL PATH of the File + file name into a list variable named LastMonthZipFiles.

How do I compare the Property ".Name" for each list variable using the "Subtract Lists" action?

 

Thank you!

  • Verified answer
    Srini007 Profile Picture
    3,490 Super User 2026 Season 1 on at

    Hi @treddfw 

     

    Try as below to get the ListDifference using Subtract Items

     

    1) Get Files in folder of Folder1, I stored it into Files1

    2) Get Files in folder of Folder2, Stored it into Files2

     

    Now we have the files with the full path, which is always different from Folder1 and Folder2, So for comparision only we need the files Names not the full path

     

    3) Create New List, Let say List1

    4) Create New List, Let say List2

    5) Now use For Each and give value as %Files1% and the variable is %CurrentItem1%

    6) Inside this you can add an action Add item to list

    7) Configure Add item to list as %CurrentItem1.Name% into List %List1%

    😎 repeat same for the List2 as well

    9) Now the two list have the file names only

    10) Now you can pass the values of List1 and List2 to Subtract List and you will get the required result

     

    Srini007_1-1698696757204.png

     

    Srini007_2-1698696782374.pngSrini007_3-1698696799181.png

     

    Below are PAD steps, Make sure you change the path of the folders

     

    Folder.GetFiles Folder: $'''D:\\Test1''' FileFilter: $'''*''' IncludeSubfolders: False 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: $'''D:\\Test-2''' FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files2
    Variables.CreateNewList List=> List1
    Variables.CreateNewList List=> List2
    LOOP FOREACH CurrentItem1 IN Files1
     Variables.AddItemToList Item: CurrentItem1.Name List: List1
    END
    LOOP FOREACH CurrentItem2 IN Files2
     Variables.AddItemToList Item: CurrentItem2.Name List: List2
    END
    Variables.SubtractLists FirstList: List1 SecondList: List2 OutputList=> ListDifference2
    

     

    If you find this reply helpful, please consider giving it a LIKE AND

    If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION

     

    Regards,

    Srini

  • treddfw Profile Picture
    41 on at

    This is beautiful. Thank you!
    I had thought I could directly access the property without looping with a "For Each" loop. Thank you for taking the time to create the code. I will keep this for teaching others how to access lists and properties.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 227 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 213 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 151

Last 30 days Overall leaderboard