Do you mean the time when the file was modified as the file name?
You could use utcNow() to get the current time, then use replace() function to remove the previous file name, leave the extension, and use the concat() function to add the current time.
Could you share a screenshot of your Flow configuration?
Different triggers may cause different expressions to be written. I use When a file is modified(properties only)(Preview) as an example here. Perhaps you could use it for reference:
Please take a try and feel free let me know if you have any question.
The image you uploaded seems to be out of order. Can you upload it again?
Do you have subfolders when configuring the trigger? Please select Yes.
Alternatively you can add a condition before performing rename action.
Perform the following operations only if the changes are not in the folder.
I did a lot of testing on my side and didn't encounter the problem you said.
It's worth noting that if you change the file, it will inevitably generate a loop, because the nature of your trigger is triggered when there is a file change, and your rename operation is to change the file.
You could use a series of operations such as Get file content-Create file to rename file.
You could freely rename files when you configure Create file action.
Then delete the previous file.
Be sure to check if you have other Flows that have similar operations on the same folder, which may affect each other.
Please try again.
The solution working fine. Got another question, for the filename, how do i include the original filename with timestamp(date only)? For example, the original file abcd.xlsx, after modified the flow create new file abcd_18-12-2018.xlsx and delete the abcd.xlsx . Next modified, the flow create new file abcd_20-12-2018 and delete the abcd_18-12-2018.xlsx .
Ideally, if the initial names of all the files in your specified folder do not contain any symbols, there may be ways to achieve your needs.
By judging whether the file name of the currently modified file contains "_", if it is not included, the current date can be directly added to the file name.
If it does, you need to replace the date with the current date.
If you have the specified folder, it is recommended to select the corresponding folder instead of Expression when configuring Folder Path.
Condition： @and(not(contains(triggerBody()?['DisplayName'], '_')),not(equals(triggerBody()?['IsFolder'], true))) Create file: replace(triggerBody()?['Path'],triggerBody()?['DisplayName'],'') concat(first(split(triggerBody()?['Name'],'.')),'_',utcNow('dd-MM-yyyy'),'.',last(split(triggerBody()?['Name'],'.'))) original: first(split(triggerBody()?['Name'],'_')) extension: last(split(triggerBody()?['Name'],'.')) Create file 2: replace(triggerBody()?['Path'],triggerBody()?['DisplayName'],'') concat(outputs('original'),'_',utcNow('dd-MM-yyyy'),'.',outputs('extension'))
Note that the Delete file action is not configured in If no branch. This is also my confusion. If configured, all files will be deleted.
This method still has problems. It seems that the Create file action in the IF no branch is similar to the Modified file. It is not creating a new file. I am improving.
Fill out a quick form to claim your user group badge now!
We've given our badges an overhaul and also added some brand new ones!
Learn how to build the business apps that you need.
Find out where you can attend!
Watch & learn from the Power Automate Community Video Gallery!