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

Remove all letters and leave only numbers

(0) ShareShare
ReportReport
Posted on by

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.

I have the same question (0)
  • 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
    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

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard