How to delete files from a directory using apache camel

Akash Singh :

I am new to Camel and was exploring ways to delete files from a particular directory using Camel. I wanted to know about the different ways of deleting files from a directory based on filters like deleting all .txt files or deleting the files which were not modified within 20 days etc.

Claus Ibsen :

That is not the purpose of Camel to delete files.

You can more easily use Java File API for that. And there is also bash scripts for such use-cases, eg housecleaning.

But if you want to attempt Camel then the file component can be used as a consumer to consume files from a filter filtered by name pattern, and also you can file by file modification day and therefore compare for age > 20 days etc.

Then you can route to a log null endpoint

Something ala

from file ? xxxxx
    to log dummy ? log = OFF

But as sad, then just use Java File API code is likely better.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

delete remote directory using apache camel

How to get the number of files in a directory with Apache Camel?

Moving files to archive directory using apache camel ftp component

How to delete files from directory using CSV in bash

How to automate the task of copying files from one directory to another using Camel

Deleting the files using Apache Camel

How to move all files from a directory(including subdirectories) to a specific directory without subdirectories in target using camel route over FTP?

How to delete random n files from directory?

How to delete a string from all files in a directory

Spring-Camel.How to read files from sftp (org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint:)

How to get the value value from soap response using apache camel?

How to find a line of code and delete that line from all files in a certain /directory only, using Linux CLI

Process multiple files using apache camel

how to read files from a directory by using R

how to delete n number of files in directory using python

How to delete all files in a directory except some globs using Puppet?

How to delete all the files present in a directory using robot framework

Delete files from directory inside Document directory?

How to delete files from a directory based on the contents of a gzipped tar file?

How to delete all files from hdfs directory with scala

With Puppeteer How To Upload Random Files From A Directory and Delete It?

How to delete files and then directory in Powershell?

Select data from table using apache camel

How to copy all files from a directory to a remote directory using scp?

How can I delete few files from a directory at restart of my OS before getting logged ? I am using ubuntu 19.10?

Apache Camel: How to download multiple files from SFTP with Premove, Move and MoveFailed options?

Zipping files with apache camel

Not able delete remote file located on a server using apache camel FTP

Apache camel: Stop exchange from proceeding to delete=true