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

Community site session details

Session Id : C30MjeKs4j44bhL797Ud8q
Power Automate - Power Automate Desktop
Unanswered

Filtering files through 'Get files in folder ' action in PAD

Like (0) ShareShare
ReportReport
Posted on 1 Apr 2021 21:18:53 by

currently I am working on files using power automate desktop, so I have the folder having 3000+ files(all pdfs) and out of it, I need to retrieve only 187 files (all pdfs) by filtering it by only the first 9 characters of the files (for ex: ABC-1234). the full file names is ABC-1234 v4.0.pdf. 

This first nine characters will be unique for each file. How can I give the filter option in the get files in folder action. Or is there any options available to retrieve the files by partial names ?

Please suggest me. Your help is much needed.

 

 image.png

 

I want to give it as in screenshot for 187 files in a single field. Looking forward for the solution. 

  • Ricardo28 Profile Picture
    3 on 17 May 2022 at 05:07:19
    Re: Filtering files through 'Get files in folder ' action in PAD

    On the file filter column, try putting the first 9 characters in between ** and that will retrieve file names with  *ABC-1234*.

  • Community Power Platform Member Profile Picture
    on 21 May 2021 at 12:37:04
    Re: Filtering files through 'Get files in folder ' action in PAD

    Hi,

     

    Continuation of the previous discussion, I would like to copy only the files which has the pattern like ABC-1244-ddeee-fsdfsdf-fsdfsd.pdf into a another folder.

     

    I tried giving the actions like below: 

     

    Radhika1_0-1621600457624.png

    It says that file to copy not found in line 5. The "Match" contains the file name and so I thought it will copy to the folder I mentioned. Can you suggest the solution for this ?

     

    Thanks

     

  • burque505 Profile Picture
    398 on 05 May 2021 at 15:53:01
    Re: Filtering files through 'Get files in folder ' action in PAD

    Great!!! 👍

    Glad it worked.

  • Community Power Platform Member Profile Picture
    on 05 May 2021 at 15:45:52
    Re: Filtering files through 'Get files in folder ' action in PAD

    Hi, I have tried something like this and it is working

    Radhika1_0-1620229516483.png

    Thank you for the solution!

  • burque505 Profile Picture
    398 on 05 May 2021 at 15:17:11
    Re: Filtering files through 'Get files in folder ' action in PAD

    You may be forced to use 'Parse text' so you can use regular expressions on the file names. That will not be fast, however. You could first use 'Get files in folder' for your list of files. Then loop through, parse for a regular expression to match your file pattern, then delete if it matches the regular expression.

     

    However, if the letters and numbers are consistent as to number of letters/digits, hyphens, and spaces, you could try this (changing '.txt' to '.pdf', of course). The '*' in the version numbers ensures it will pick up things like "XZH-4239-v.27.292 QRZ [etc.]". You can of course experiment with different sequences of '?' and '*' until you can be virtually certain it will pick up all your use cases.

    wild_cards.PNG

  • Community Power Platform Member Profile Picture
    on 05 May 2021 at 13:11:34
    Re: Filtering files through 'Get files in folder ' action in PAD

    The problem is I don't have the same letter and number for each file. Each file has different letters and numbers, they are unique.

  • burque505 Profile Picture
    398 on 05 May 2021 at 13:04:34
    Re: Filtering files through 'Get files in folder ' action in PAD

    Here's a flow to get a list of files:

    flow.PNG

    The 'Get files in folder' activity:

    files.PNG

    Now you have a List of all files matching the pattern. You can loop through the list and delete them.

    Here are files in my folder:

    in folder.PNG

    Now, a message displaying the three that match:

    message.PNG

    These are in the variable List called %Files%. Just loop through the list and delete.

  • Community Power Platform Member Profile Picture
    on 05 May 2021 at 07:03:27
    Re: Filtering files through 'Get files in folder ' action in PAD

    hi,

    I  need a help regarding the topic we discussed here. I need to delete the files which have the same pattern as

    ABC-1234-v.4.0 HTM - xxxxx x x x x xxxxxx.pdf

     

    I tried this in PAD:

    Radhika1_1-1620198073539.png

     

    As you see in the screenshot, it is taking the file which has a same pattern but if I use delete that 'Match', it says that File to delete not found. How to delete only the files which have the pattern like 

    ABC-1234-v.4.0 HTM - xxxxx x x x x xxxxxx.pdf

     

    Thanks,

    Radhika

  • Community Power Platform Member Profile Picture
    on 30 Apr 2021 at 12:34:26
    Re: Filtering files through 'Get files in folder ' action in PAD

    Hi, 

    Even I also thought so, deleting the files in the source folder and replacing the new files in the folder structure will work. Thanks for your reply.

  • burque505 Profile Picture
    398 on 29 Apr 2021 at 15:23:51
    Re: Filtering files through 'Get files in folder ' action in PAD

    Hi @Anonymous, I don't believe that option is among the many that robocopy has. Please take a look at this guide by Adam The Automator to robocopy. I would suggest perhaps a) copying the new files to a folder as you presently do, perhaps with the /mov option or another combination of options; b) also copying them to a temp folder;  c) deleting the files in the source folder; and d) copying the files in the temp folder back to the source folder.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete