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 ?
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
Hi @yamina ,
Please find the solution.
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
1. Get current date (date only)
2. Format the date to custom date time
3. Use that FormattedDateTime -variable in the new file name just before the file extension (.csv)
Looks like this as a whole:
eetuRobo
18
Super User 2025 Season 1
stampcoin
6
John_Mavridis
6
Microsoft Employee