redhead
redhead

Reputation: 1317

Limit number of files in folder using camel

We use Apache Camel to integrate with 3rd party via SFTP. Once in a while we send a file to the SFTP folder and we want, for the purpose of backup, to leave some of the older files there. But we do not want to leave them there forever, as they can take up space as the time passes.

Can Camel somehow limit the number of files in the folder? Or is there a way to clean the folder once in a while using another route?

My ideas using filter and sortBy kind of failed, since it does not poll all files at once.

Maybe it's not a problem for Camel to solve, but since it already knows how to connect via SFTP and delete files I wanted to reuse it's capabilities.

Upvotes: 0

Views: 375

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55750

Yes its not per see a problem for Camel to do house cleaning. The owners of the FTP servers usually can setup a scheduled cron job etc to cleanup their FTP servers.

Having to remotely login from Camel as a FTP client and do house cleaning on other FTP servers is not recommended.

Camel is about integration and connecting systems, eg in your case to upload files to a FTP server. How they manage and cleanup and operate their FTP server is not a Camel problem.

Upvotes: 2

Related Questions