File Component

The File component provides access to file systems; allowing files to be processed by any other Camel Components or messages from other components can be saved to disk.

URI format

file:fileName

Where fileName represents the underlying file name

URI Options

NameDefault ValueDescription
initialDelay1000milliseconds before polling the file/directory starts
delay500milliseconds before the next poll of the file/directory
useFixedDelayfalseif true, poll once after the initial delay
recursivetrueif a directory, will look for changes in files in all the sub directories
locktrueif true will lock the file for the duration of the processing
regexPatternnullwill only fire a an exchange for a file that matches the regex pattern
deletefalseIf delete is true then the file will be deleted when it is processed (the default is to move it, see below)
noopfalseIf true then the file is not moved or deleted in any way (see below). This option is good for read only data, or for ETL type requirements
moveNamePrefixnullThe prefix String prepended to the filename when moving it. For example to move processed files into the done directory, set this value to 'done/'
moveNamePostfixnullThe postfix String apended to the filename when moving it. For example to rename processed files from foo to foo.old set this value to '.old'

By default the file is locked for the duration of the processing. Also when files are processed they are moved into the .camel directory; so that they appear to be deleted.

Message Headers

The following message headers can be used to affect the behaviour of the component

HeaderDescription
org.apache.camel.file.nameSpecifies the output file name (relative to the endpoint directory) to be used for the output message when sending to the endpoint. If this is not present then a generated message ID is used instead

See Also