如何删除.camel子文件夹中的旧文件?

huangapple go评论96阅读模式
英文:

How can I remove old Files in .camel Subfolder?

问题

是的,Camel的File-Endpoint允许你自动删除旧于x周的文件,而无需使用外部工具。你可以使用File-Endpoint的"delete"参数来实现这一功能。要配置File-Endpoint以自动删除旧文件,你可以添加类似以下的配置:

<from uri="file:/path/to/your/files?delete=true&maxDepth=1&antInclude=*.txt&antFilterCaseSensitive=false&antFilterCaseInsensitive=true&readLock=changed&readLockCheckInterval=1000&readLockMinLength=0&readLockTimeout=10000&readLockMarkerFile=true"/>

在上述配置中,关键参数是"delete=true",它告诉Camel在读取文件后删除它们。你可以根据你的需求调整其他参数,如"maxDepth"(最大递归深度),"antInclude"(包括的文件模式),"antFilterCaseSensitive"(是否区分大小写),以及"readLock"参数,以控制文件删除的行为。

这将使Camel自动删除旧于x周的文件,而无需使用外部工具。希望这对你有帮助!

英文:

I use a File-Endpoint to read files. After Camel reads the file it moves the file to the subfolder .camel. So thats OK, and thats what I want. But after some months there are thousends of files.

It is possible to remove automaticly files older than x weeks? Without external tools? Is there an option for the File-endpoint? I don't find anything.

Thanks a lot

答案1

得分: 0

没有这样的支持或工具。通常情况下,您将文件移动到某个备份文件夹,然后有一些其他系统来负责处理这些文件的维护。

让Camel监视并删除早于X时间的文件并不适合,尽管您可以构建一个执行这项任务的路由。

通常,您的系统管理员有自己管理基础设施的方式。

英文:

No there is no such support or tool. Usually you move files to some backup folder, and then you have some other system that takes care of house keeping those files.

It's not suitable to let Camel monitor for files older than X and delete them, even though you can build a route doing that.

Often your sys admins have their own way of managing their infrastructure.

huangapple
  • 本文由 发表于 2020年8月28日 16:16:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/63630000.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定