Skip to main content

Notifications

Community site session details

Community site session details

Session Id : o2ZifslGnRH5Pz5ovk6J/M
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
    SriniK Profile Picture
    3,025 Super User 2025 Season 1 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
    SriniK Profile Picture
    3,025 Super User 2025 Season 1 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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,075 Most Valuable Professional

Leaderboard
Loading started
Loading complete