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 in get files...
Power Automate
Unanswered

Filtering in get files folder action using ??? character/Code

(0) ShareShare
ReportReport
Posted on by 48

Filtering in get files folder action using ??? character. 

 

Kindly suggest, how to filter files like XXXX.XXX? I need to filter after extension that is should only have 3 numbers after '.' (DOT)as extension is number.

 

I have the same question (0)
  • Kaif_Siddique Profile Picture
    2,108 Super User 2024 Season 1 on at

    Could you elaborate your requirements ?

     

    But, it seems trying to filter the files which has 3 letter after extension(like .txt, .xls etc). Use wildcard option to filter the file. If yes, then use *.??? to filter the files.

    Kaif_Siddique_0-1675540356164.png

     

    Regards

    Kaif

  • UserCflows_12 Profile Picture
    48 on at

    Hello

    Thank you for the reply. But I have numbers after dot.

     

    Ex: FILENAME.128, somehow it wasn't working for numbers.

    Mainly i want to remove files having

    FILENAME.128(1)

     

    Kindly mention

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    What about just *(

     

    then it would grab anything with parenthesis. 

  • UserCflows_12 Profile Picture
    48 on at

    Thank you for the response ,  but basically i don't want to filter them with parenthesis.

     

    My files for ex: Filename.xxx(1), Filename.xxx(2),Filename.xxxx. It shouldn't filter any of these in GET FILES IN FOLDER.

     

    Need only correct order files Filename.XXX, this is format I need , only filter those. Only 3 digits/number in extension. please suggest.

  • UserCflows_12 Profile Picture
    48 on at

    Hello, 

     

    can anyone kindly reply to this. Needing suggestion on this.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    You are not going to like this answer:

     

    The Get files uses basic command prompts (which is the same as the search bar in the upper right corner of a Windows Explorer box).  Everything I read says that .### or some equivalent isn't an option.  There is just * (for any number of characters before or after and ?.

     

    Get files *.??? (this will pull all files with numbers, letters, or combos of both, but at least it will limit to those with extensions.

    For each %CurrentItem% in %Files%

        Convert %CurrentItem.Extension% to Number; save as %ExtensionTest%

            On Error - Go to Label "SkipFile"

        If %ExtensionTest% > 0

            'do whatever you need to with the file

        End (if)

        Label: SkipFile

    End (for each)

     

    I think this is your best bet given that you can't just filter for .###; it should skip the unneeded files very quickly.

     

    Another option would be creating a new list, do the first part of the logic through the whole list and adding files you want to do to a new list, then just running a for each on the new list:

    If %ExtensionTest% > 0

        'add %CurrentItem% to %NewList%

    End (if)

     

    'then just for each on %NewList% since you've already validated all these file extensions.

     

    Good luck!

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

    Maybe this approach wil lwork too:

     

    1. Get all files in folder - no filtering --> %FilesAll%

    2. Get "broken" files with *(  filtering as@MichaelAnnis ssuggested --> %BrokenFiles%

    3. Use action "Subtract lists" and subtract %BrokenFiles% from %FilesAll%

    4. You end up with list of "correct" files

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    I agree with @momlo , this may work faster. I would limit #1 to *.??? Instead at all files. 

    good luck!

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard