Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 9zz4Oh4k/GD/HPeQtxsLkT
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,273 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

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…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Power Automate Desktop

#1
eetuRobo Profile Picture

eetuRobo 18 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 6

#2
John_Mavridis Profile Picture

John_Mavridis 6 Microsoft Employee

Overall leaderboard