Forum Home » Fuse Distributions » Fuse ESB

Thread: Browse a directory without reading files content

 

Permlink Replies: 1 - Last Post: Jul 18, 2012 5:40 AM Last Post By: davsclaus
vmahe

Posts: 24
Registered: 04/27/12
Browse a directory without reading files content
Posted: Jul 18, 2012 5:27 AM
  Click to reply to this thread Reply
Hello everyone,

Is there any build-in component in Fuse which enables you to regularly browse a directory recursively and generate a message for each file found ?

I know that there is the from(file://directoryName) component which enables you to regularly browse a directory, but the issue here is that the content of each found file seems to be read by the component.
Is there a way to tell this component not to read the file, just to send some Exchange message containing the name of the file (in the message body or header) ?

It's because here I deal with big video files for which I only want to monitor file size evolution and not with files containing text that needs to be handled.

Thanks

Regards

Vincent
davsclaus

Posts: 1,893
Registered: 10/14/08
Re: Browse a directory without reading files content
Posted: Jul 18, 2012 5:40 AM   in response to: vmahe in response to: vmahe
  Click to reply to this thread Reply
The file is only read on demand, so you can just avoid reading the file.

You could also just change the message body to null, empty, file name etc.

eg we transform the message body to the file name

from("file:inbox").
  transform(header("CamelFileName"))