使用正则表达式获取带有当前日期的文件名
我遇到的情况是,我必须每天在特定时间获取一个新文件,该文件会使用 GETSFTP 处理器自动保存在远程服务器上的特定文件夹中。
例如,今天将在远程服务器上创建一个名为 20220223.csv(当前日期 2 月 23 日)的文件。 PS 我只想获取当前日期的一个文件,并且我不想每天动态更新 GETSFTP 处理器中的文件名。
注意:不支持表达式语言。
I have a situation where I have to get a new file every day at a specific time which is saved automatically on a specific folder on a remote server using GETSFTP Processor.
for example today there will be a file created on a remote server named 20220223.csv (23rd of Feb current date). P.s I want to get only one file of the current date and I don't want to update my filename in the GETSFTP processor dynamically every day.
NOTE: Expression Language is not supported.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如您所知,文件名是“yyyyMMdd.csv”,您不需要使用文件过滤器正则表达式。
相反,请使用 UpdateAttribute 通过
${now():toDate():format('yyyyMMdd')}.csv
设置filename
属性。在 GetSFTP 中,将
远程路径
属性设置为/home/data/user/${filename}
。注意:您还可以将其组合到 GetSFTP 中,并将
Remote Path
设置为/home/data/user/${now():toDate():format('yyyyMMdd')} .csv
,我只是喜欢UpdateAttribute的可读性As you know the file name is `yyyyMMdd.csv' you don't need to use a file filter regex.
Instead, use an UpdateAttribute to set a
filename
attribute with${now():toDate():format('yyyyMMdd')}.csv
.In GetSFTP, set the
Remote Path
property to/home/data/user/${filename}
.Note: You could also combine that into just the GetSFTP with
Remote Path
set to/home/data/user/${now():toDate():format('yyyyMMdd')}.csv
, I just like the readability of UpdateAttribute