Skip to content

FolderWatcher Binding ​

This binding is intended to monitor a local folder, FTP and S3 bucket and their subfolders and notify of new files.

Supported Things ​

The binding support three types of things: localfolder, ftpfolder, s3bucket and azureblob.

Thing Configuration ​

The localfolder thing has the following configuration options:

ParameterNameDescriptionRequiredDefault value
localDirLocal DirectoryLocal directory to be watchedyesn/a
listHiddenLocalList HiddenAllow listing of hidden filesyesNo
pollIntervalLocalPolling interval in secondsInterval for polling folder changesyes60
listRecursiveLocalList Sub FoldersAllow listing of sub foldersyesNo

The ftpfolder thing has the following configuration options:

ParameterNameDescriptionRequiredDefault value
ftpAddressFTP serverIP address of FTP serveryesn/a
ftpPortFTP portPort of FTP serveryes21
secureModeFTP SecurityFTP SecurityyesNone
ftpUsernameUsernameFTP user nameyesn/a
ftpPasswordPasswordFTP passwordyesn/a
ftpDirRootDirRoot directory to be watchedyesn/a
listRecursiveFtpList Sub FoldersAllow listing of sub foldersyesNo
listHiddenList HiddenAllow listing of hidden filesyesfalse
connectionTimeoutConnection timeout in secondsConnection timeout for FTP requestyes30
pollIntervalPolling interval in secondsInterval for polling folder changesyes60
diffHoursTime stamp difference in hoursHow many hours back to analyzeyes24

The s3bucket thing has the following configuration options:

ParameterNameDescriptionRequiredDefault value
s3BucketNameS3 Bucket NameName of the S3 bucket to be watchedyesn/a
s3PathS3 PathS3 path (folder) to be monitorednon/a
pollIntervalS3Polling IntervalInterval for polling S3 bucket changes, in secondsyes60
awsKeyAWS Access KeyAWS access keynon/a
awsSecretAWS SecretAWS secretnon/a
awsRegionAWS RegionAWS region of S3 bucketyes""
s3AnonymousAnonymous ConnectionConnect anonymously (works for public buckets)yestrue

The azureblob thing has the following configuration options:

ParameterNameDescriptionRequiredDefault value
azureAccountNameAzure Account NameName of the Azure account where the container locatedyesn/a
azureContainerNameAzure Blob Container NameName of the Azure container to be watchedyesn/a
containerPathContainer PathContainer path (folder) to be monitoredno""
pollIntervalAzurePolling IntervalInterval for polling Azure container changes, in secondsyes60
azureAnonymousAnonymous ConnectionConnect anonymously (works for public containers)nofalse
azureAccessKeyAzure AccessAccess Key for Azure storage accountno""

Events ​

This binding supports the following event:

Channel Type IDItem TypeDescription
newfileStringA new file name discovered

Full Example ​

Thing configuration:

java
folderwatcher:localfolder:myLocalFolder [ localDir="/myfolder", pollIntervalLocal=60, listHiddenLocal="false", listRecursiveLocal="false" ]
folderwatcher:ftpfolder:myLocalFolder   [ ftpAddress="X.X.X.X", ftpPort=21, secureMode="EXPLICIT", ftpUsername="username", ftpPassword="password", ftpDir="/myfolder/",  listHidden="true", listRecursiveFtp="true", connectionTimeout=33, pollInterval=66, diffHours=25 ]
folderwatcher:s3bucket:myS3bucket       [ s3BucketName="mypublic-bucket", pollIntervalS3=60, awsRegion="us-west-1", s3Anonymous="true" ]

Using in a Rule ​

Local folder example:

rules
rule "New Local file"
when
    Channel "folderwatcher:localfolder:myLocalFolder:newfile" triggered
then
    logInfo("NewLocalFile", receivedEvent.toString())
end

FTP example:

rules
rule "New FTP file"
when
    Channel "folderwatcher:ftpfolder:myFTPFolder:newfile" triggered
then
    logInfo("NewFTPFile", receivedEvent.toString())
end

S3 bucket example:

rules
rule "New S3 file"
when
    Channel "folderwatcher:s3bucket:myS3bucket:newfile" triggered
then
    logInfo("NewS3File", receivedEvent.toString())
end

Azure Blob container example:

rules
rule "New Azure file"
when
    Channel "folderwatcher:azureblob:myAzureBlob:newfile" triggered
then
    logInfo("NewAzureFile", receivedEvent.toString())
end