Skip to main content
Inspiring
June 19, 2013
Question

Directorywatcher COldfusion Executing 3 times

  • June 19, 2013
  • 0 replies
  • 332 views

Hi,

I created one Directory watcher through admin and I found that it is executing more than once. Is there anything that I am missing?

The configuration file is as below

 

#

# DirectoryWatcherGateway configuration file

#

# The directory you want to watch. If you are entering a Windows path

# either use forward slashes (C:/mydir) or escape the back slashes (C:\\mydir).

directory=D:\\Balu\\changes\\9786\\Codeset\\OpportunityDirectoryWatcher\\FTPFolder

# Should we watch the directory and all subdirectories too

# Default is no. Set to 'yes' to do the recursion.

recurse=no

# The interval between checks, in miliseconds 

# Default is 60 seconds

# interval=180

# The comma separated list of extensions to match.

# Default is * - all files

extensions=*

# CFC Function for file Change events

# Default is onChange, set to nothing if you don't want to see these events

changeFunction=onChange

# CFC Function for file Add events

# Default is onAdd, set to nothing if you don't want to see these events

addFunction=onAdd

# CFC Function for file Delete events

# Default is onDelete, set to nothing if you don't want to see these events

deleteFunction=onDelete





The cfc is as below:





<cfcomponent>

<cfset

variables.filepath = "D:\Balu\changes\9786\Codeset\OpportunityDirectoryWatcher\FTPFolder\userdetail.txt"

>

 

 

<cffunction

name="onAdd" output="false" returnType="void"

>

<cfargument name="CFEvent" type="struct" required="true"

>

<cfset var fileData = ""

>

<cfset var firstName=""

>

<cfset var lastName = ""

>

<cfset var age = ""

>

<cfset var school = ""

>

<cftry>

<cffile action="read" file="#variables.filepath#" variable="fileData"

>

<cffile action="write" output="#createuuid()#" file="D:\Balu\changes\9786\Codeset\OpportunityDirectoryWatcher\#createUUID()#.txt"

>

<cfloop index="eachrow" list="#fileData#" delimiters="#chr(10)##chr(13)#"

>

<cfquery name="insertData" datasource="testsb"

>

INSERT INTO

[testsb].[dbo].[usertable]

([firstname]

,[lastname]

,[age]

,[school])

VALUES

(

<cfloop index="eachColumn" list="#eachrow#" delimiters="#chr(9)#"

>

'#eachColumn#'

<cfif ListLast(eachrow,chr(9)) eq eachColumn

>

<cfelse>

,

</cfif>

</cfloop>

)

</cfquery>

</cfloop><cfabort>

<cfcatch type="any"

>

<cfdocument format="pdf" overwrite="true" filename="D:\Balu\changes\9786\Codeset\OpportunityDirectoryWatcher\error.pdf"><cfdump var="#cfcatch#"

></cfdocument>

</cfcatch>

</cftry>

</cffunction>

<cffunction

name="onChange" output="false" returnType="void"

>

<cfargument name="CFEvent" type="struct" required="true"

>

</cffunction>

 

 

</cfcomponent>

This topic has been closed for replies.