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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Filtering files throug...
Power Automate
Unanswered

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

(0) ShareShare
ReportReport
Posted on 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. 

I have the same question (0)
  • Lipsitz Profile Picture
    75 on at

    Loop will do it

  • Community Power Platform Member Profile Picture
    on at

    out of the full name, can we filter only by initial some files of the files. Because I tried if loop, that is if the folder contains ABC-1234, then copy that file, but it is not working. 

    In Get files in folder, we need to give the full file name in order to retrieve, but I cannot give the full file name, because the version may change frequently. So, I should be able to filter the files only by initial nine values of the file.

    How do I do that?

     

  • fraenK Profile Picture
    2,125 on at

    You first get all files in a folder as a list and then use for each to go through each item in the list and check if the filename contains your filter criteria. If yes, then do whatever you want to do. Really simple. 

  • fraenK Profile Picture
    2,125 on at

    Alternative: if the file names follow a common scheme, then you can convert the list to text and extract the matching file paths using a regular expression. Should be much faster than for each.

  • Community Power Platform Member Profile Picture
    on at

    I tried exactly what you mentioned, I have created 100 files in the list and checked each file using 'for each'. If it contains the specific file name, it should move to the specific folder. Likewise, there are 7 folder and subfolders. So according to the file name, it should go to the specific folder. Approximately it takes 1 minute per file to check the entire 100 files list.  100 files it takes 100 mins which is too long I feel.

     

    Is there any solution? or is there any option to search for the file name in the folder generally as a whole(not as a each item) like what we do manually, just go to the folder and search for the file name.

  • fraenK Profile Picture
    2,125 on at

    See faster alternative above. But I doubt that it takes 1min per file. Don't run it in edit mode!

  • Community Power Platform Member Profile Picture
    on at

    It takes 1 min because, I have created nearly 25 separate lists for 25 folders so each file has to check with 25 lists and do the necessary action.

     

    image.png

     

    Now, I tried like this, is there any possibility to provide more than one value in the second operand of the 'if' action using AND operator, then my job will be easy.

     

    and how to check whether it is running in edit mode!

  • Community Power Platform Member Profile Picture
    on at

    and how to check whether it is running in edit mode!

  • fraenK Profile Picture
    2,125 on at

    Why 25 lists? Get files in folder works for subfolders as well. Why don't you use a regular expression for checking the filename? Edit mode is when you open the flow for editing

  • Community Power Platform Member Profile Picture
    on at

    sure, I will check the regular expression

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard