Spring Cloud Data Flow将时间戳添加到文件名

时间:2019-11-22 20:43:10

标签: spring-boot file spring-cloud-stream spring-cloud-dataflow sink

我正在尝试将开箱即用的Source和Sink流应用程序与Spring Cloud数据流一起使用。我正在尝试将文件从一个文件夹移动到另一个文件夹。当文件到达接收器时,我想重命名它,并将日期或时间戳记附加到文件名。我该怎么做呢?我假设使用name-expression字段,但是我不确定这可以取什么值。我在此字段中尝试的任何操作似乎都会导致错误。

我希望文件的名称类似于test20191122.txt

file sink props

1 个答案:

答案 0 :(得分:1)

类似...

'test' + new java.text.SimpleDateFormat('yyyyMMdd').format(new java.util.Date()) + '.txt'

...应该工作。

相关问题