Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Adding timestamp to the file name before extension

avatar
Explorer

Hi Team,

I want to rename/modify the filename of the flowfile with the timestamp added to it. Let's say the original flowfile name is file1.txt, I want to change the name of file to be file1_<timestamp>.txt. I used updateAttribute processor to do it. The expression which I gave is

 

${filename:substringBeforeLast(‘.’)}_${now():format("yyyy-MM-dd HH:mm:ss.SSS’Z’”)}.${filename:substringAfter('.')}

 

This Giving me error. I'm bad at Expression language. could anyone help me in this?
Thanks. 

1 ACCEPTED SOLUTION

avatar
Super Mentor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
2 REPLIES 2

avatar
Explorer
${filename:substringBeforeLast(‘.’)}_${now():format("yyyy-MM-dd-HH-mm-ss")}.${filename:substringAfter('.')}

 This expression worked fine. Thanks

avatar
Super Mentor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login