web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Ascending numbering by...
Power Automate
Unanswered

Ascending numbering by date

(0) ShareShare
ReportReport
Posted on by

Screenshot 2024-06-18 225155.pngThe following problem:

I want to rename the files in a folder so that they contain the creation date and a numbering per day

 

Currently it numbers the files in the folder without considering the creation date how can I change it like this

 

 

Example:

10_06_2024 Nr.01

10_06_2024 Nr.02

10_06_2024 Nr.03

11_06_2024 Nr.01

11_06_2024 Nr.02

etc.

 

please ignore point 2-4 it is for later integration 

 

Thanks 🙏

  • NathanAlvares24 Profile Picture
    1,714 Moderator on at

    Hi @niklas_haar !

     

    Try out this flow.

    NathanAlvares24_0-1718772368608.pngNathanAlvares24_1-1718772381460.png

     

     

    The code (simply copy paste into your PAD flow):

     

    SET nCounter TO 1
    Variables.CreateNewList List=> CreationDateList
    Folder.GetFiles Folder: path FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.CreationTime SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
    LOOP FOREACH File IN Files
     SET CreationDate TO File.CreationTime
     Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CreationDate CustomFormat: $'''dd_MM_yyyy''' Result=> CreationDate
     IF Contains(CreationDateList, CreationDate, True) THEN
     IF nCounter < 10 THEN
     File.RenameFiles.Rename Files: File NewName: $'''%CreationDate% Nr.0%nCounter%''' KeepExtension: True IfFileExists: File.IfExists.DoNothing RenamedFiles=> RenamedFiles
     ELSE
     File.RenameFiles.Rename Files: File NewName: $'''%CreationDate% Nr.%nCounter%''' KeepExtension: True IfFileExists: File.IfExists.DoNothing RenamedFiles=> RenamedFiles
     END
     Variables.IncreaseVariable Value: nCounter IncrementValue: 1
     ELSE
     Variables.AddItemToList Item: CreationDate List: CreationDateList
     SET nCounter TO 1
     File.RenameFiles.Rename Files: File NewName: $'''%CreationDate% Nr.0%nCounter%''' KeepExtension: True IfFileExists: File.IfExists.DoNothing RenamedFiles=> RenamedFiles
     Variables.IncreaseVariable Value: nCounter IncrementValue: 1
     END
    END
    

     

     

    Input (Before):

    NathanAlvares24_3-1718772444214.png

     

    Output (After):

    NathanAlvares24_2-1718772429532.png

     

    I hope this helps.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 426

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard