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 / Remove all letters and...
Power Automate
Answered

Remove all letters and leave only numbers

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Is there any way to remove all letters when renaming a file, leaving only the numbers? For example, the file "TEST 56784-74" needs to be renamed "5678474". Is it possible to do that? I know that there is an option to remove text when renaming, but there is not only the "TEST 56784-74" file, there are variations of it, however there will always be a numeric string, which is what I need.

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @Anonymous ,

     

    This method might work if you can pass your variable back to PowerAutomate....

     

    https://www.alanps1.io/power-platform/flow/flow-stripping-unwanted-characters-or-special-characters-from-a-string/

     

  • Verified answer
    ZS440 Profile Picture
    262 on at

    hi @Anonymous 

    How about a flow like this?

    Screenshot 2021-02-26 211101.jpg

    Screenshot 2021-02-26 211139.jpg

    # Create a Files folder on your desktop.
    Folder.GetSpecialFolder SpecialFolder: Folder.SpecialFolder.DesktopDirectory SpecialFolderPath=> SpecialFolderPath
    Folder.GetFiles Folder: $'''%SpecialFolderPath%\\files''' FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
    LOOP FOREACH CurrentItem IN Files
     Text.Replace Text: CurrentItem.NameWithoutExtension TextToFind: $'''[^0-9]+''' IsRegEx: True IgnoreCase: False ReplaceWith: $'''%''%''' ActivateEscapeSequences: False Result=> Replaced
     File.Rename Files: CurrentItem NewName: Replaced KeepExtension: True IfFileExists: File.IfExists.DoNothing RenamedFiles=> RenamedFiles
    END
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    apparently it works, thanks. Taking the opportunity, would you tell me what function to put in case you want to remove only Numbers? does "\ d" work?

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
David_MA Profile Picture

David_MA 229 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 223 Super User 2026 Season 2

#3
Valantis Profile Picture

Valantis 136 Super User 2026 Season 2

Last 30 days Overall leaderboard