使用正则表达式获取带有当前日期的文件名

发布于 2025-01-09 02:55:23 字数 491 浏览 2 评论 0原文

我遇到的情况是,我必须每天在特定时间获取一个新文件,该文件会使用 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.

this is my try but it gets all the files available.

NOTE: Expression Language is not supported.

NOTE: Expression Language is not supported.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疯了 2025-01-16 02:55:23

如您所知,文件名是“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 theRemote 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文