Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Power Automate Desktop
Answered

rename file with personalised date in power automate desktop

Like (1) ShareShare
ReportReport
Posted on 8 Jul 2024 08:33:02 by 7

Hello , 

I want to rename each monday a file  like this 

 

Name of the file ; ETATS-GRF-STOCK-HEBDO.CSV

After the last word, I want to insert the date of the file - 7 days 

 

Here the result : ETATS-GRF-STOCK-HEBDO 01-07-2024.csv  ( 01 is the day and 07 is the month )

 

How can I do thas in my flow ? 

yamina_0-1720427281546.png

 

  • yamina Profile Picture
    7 on 08 Jul 2024 at 09:37:59
    Re: rename file with personalised date in power automate desktop

    Thank you @eetuRobo, your solution helped me but a step was missing. 

    CurrentDateTime TimeToAdd: -7

    so I combine the two answers and here the result

    yamina_0-1720431400577.png

     

  • Verified answer
    VishnuReddy1997 Profile Picture
    2,324 Super User 2025 Season 1 on 08 Jul 2024 at 08:48:19
    Re: rename file with personalised date in power automate desktop

    Hi @yamina ,

     

    Please find the solution.

    VishnuReddy1997_0-1720428439029.png

    Code:

    FUNCTION '7Days' GLOBAL
     DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateOnly CurrentDateTime=> CurrentDateTime
     DateTime.Add DateTime: CurrentDateTime TimeToAdd: -7 TimeUnit: DateTime.TimeUnit.Days ResultedDate=> ResultedDate
     Text.SplitText.Split Text: ResultedDate StandardDelimiter: Text.StandardDelimiter.Space DelimiterTimes: 1 Result=> ResultedDate
     File.RenameFiles.Rename Files: $'''C:\\Users\\Downloads\\mjlangone_0-1719864376475.png''' NewName: $'''ETATS-GRF-STOCK-HEBDO %ResultedDate[0]%.csv''' KeepExtension: True IfFileExists: File.IfExists.Overwrite RenamedFiles=> RenamedFiles
    END FUNCTION

     

    (Note:- if you got your solution you can mark as solution and gives kudos)


    Thanks & Regards

    Vishnu Reddy

     

  • Verified answer
    eetuRobo Profile Picture
    3,419 Super User 2025 Season 1 on 08 Jul 2024 at 08:44:23
    Re: rename file with personalised date in power automate desktop

    1. Get current date (date only)

    eetuRobo_2-1720428222296.png

     

    2. Format the date to custom date time

    eetuRobo_1-1720428213658.png


    3. Use that FormattedDateTime -variable in the new file name just before the file extension (.csv)

    eetuRobo_0-1720428202510.png


    Looks like this as a whole:

    eetuRobo_3-1720428256182.png

     

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

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

Leaderboard > Power Automate - Power Automate Desktop

#1
eetuRobo Profile Picture

eetuRobo 147 Super User 2025 Season 1

#2
Riyaz_riz11 Profile Picture

Riyaz_riz11 56 Super User 2025 Season 1

#3
Nived_Nambiar Profile Picture

Nived_Nambiar 30 Super User 2025 Season 1

Overall leaderboard
Loading started