Skip to main content
Community site session details

Community site session details

Session Id : ryCfICZsdCTdjx+bOeLURw
Power Automate - Power Automate Desktop
Answered

Rename File - Remove Characters

Like (0) ShareShare
ReportReport
Posted on 15 Apr 2024 20:06:51 by 22

Hello,

I have over 30 files I download daily into 1 folder that all have different names. I need to remove the last 13 characters on each file name, so from the dash to the end. I just don't know what to put in "text to remove". Everything I've tried gives me an error. Is this possible?

For this example I just need it to be ABCDE Test and FGHIJ Report.

marksben32_0-1713211233330.png

Any help is greatly appreciated. Thanks in advance!

  • Verified answer
    Srini007 Profile Picture
    3,234 Super User 2025 Season 2 on 16 Apr 2024 at 06:48:49
    Re: Rename File - Remove Characters

    Hi @marksben32 

     

    If the above post resolves your issue, then click on ACCEPT AS SOLUTION , so that it will helpful to others

     

    Cheers,

    Srini

     

  • marksben32 Profile Picture
    22 on 15 Apr 2024 at 20:55:45
    Re: Rename File - Remove Characters

    That worked! Thank you so much!

  • Verified answer
    Srini007 Profile Picture
    3,234 Super User 2025 Season 2 on 15 Apr 2024 at 20:38:12
    Re: Rename File - Remove Characters

    Hi @marksben32 

     

    Try as below

     

    Srini007_0-1713213439908.png

     

     

    Folder.GetFiles Folder: $'''D:\\Test_String''' FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files3
    LOOP FOREACH CurrentItem3 IN Files3
     IF Contains(CurrentItem3, $'''-''', False) THEN
     Text.SplitText.SplitWithDelimiter Text: CurrentItem3 CustomDelimiter: $'''-''' IsRegEx: False Result=> TextList
     File.RenameFiles.Rename Files: CurrentItem3 NewName: TextList[0] KeepExtension: True IfFileExists: File.IfExists.DoNothing RenamedFiles=> RenamedFiles
     END
    END
    

     

    If you find this reply helpful, please consider giving it a LIKE AND

    If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION

     

    Cheers,

    Srini

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete