Monitor folder

Discuss RoboTask here
Post Reply
dbortunk
Posts: 27
Joined: Mon Jun 08, 2009 10:38 am

Monitor folder

Post by dbortunk »

How would you create a task to monitor if a folder exists and if it does not exist send an email and create the folder and continue monitoring if it exists?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Monitor folder

Post by Oleg »

IMHO, it's better to make two tasks.

First task monitors the folder c:\MyFolder (see "file monitor" triggering event)

Second task checks the existence of the folder and creates if it doesn't exist.

If {FolderExists(c:\MyFolder)}=false then
   create folder "c:\MyFolder"
end if

Second task may be triggered by Cyclic event. (suppose, each 15 sec)
dbortunk
Posts: 27
Joined: Mon Jun 08, 2009 10:38 am

Monitor folder

Post by dbortunk »

I don't see how you setup the file monitor to watch for a folder existing or not.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Monitor folder

Post by Oleg »

See my previous post. You don't need file monitor to check existence of the folder.

Also see the task below:
;*******************************
;* RoboTask Task file
;* Do not edit in text editor!
;*******************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1380072790
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task785"
Hide=INTEGER|0
ID=INTEGER|101531131
LogOnAsUser=INTEGER|1
Name=STRING|"Check the folder existence"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action1\Params]
case=STRING|"0"
operator=STRING|"1"
type=STRING|"3"
value1=STRING|"{FolderExists(c:\testfolder)}"

[Actions\Action2]
ActionID=STRING|"A_FOLDER_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create Folder (c:\testfolder)"
Params=FOLDER

[Actions\Action2\Params]
newfolder=STRING|"c:\testfolder"

[Actions\Action3]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_GENERAL_CYCLIC"
Params=FOLDER

[Events\Event1\Params]
id=STRING|"C1TFCGHI"
interval=STRING|"15"

Last edited by Oleg on Tue Jun 09, 2009 2:54 pm, edited 1 time in total.
Post Reply