Auto deleting.

Discuss RoboTask here
Post Reply
gumby69
Posts: 6
Joined: Fri Dec 11, 2009 8:10 am

Auto deleting.

Post by gumby69 »

i need to delete files in a folder only older than 24 hours i'm new to this can anyone tell me how to do it? It would be much appreciated. Thank You
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Auto deleting.

Post by Oleg »

See the example below. I think you can change this task for your purposes. Also you can attach cyclic event to the task, for example each 900 s (15 min)

;*******************************
;* RoboTask Task file         &n bsp;*
;* Do not edit in text editor! *
;*******************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1146669232
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task18"
Hide=INTEGER|0
ID=INTEGER|2005651541
LocalVariables=STRING|"c_file,c_date"
LogOnAsUser=INTEGER|1
Name=STRING|"Detect files older than 24 hours"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|2
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER

[Actions\Action1]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action1\Params]
createmode=STRING|"1"
date1=STRING|"20091211"
date2=STRING|"20091211"
destvar=STRING|"C_FILE"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{TempDir}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"1"
timevar=STRING|"C_DATE"
WithoutPath=STRING|"0"

[Actions\Action2]
ActionID=STRING|"BASIC_EVALUATE"
Enabled=INTEGER|-1
Name=STRING|"Evaluate"
Params=FOLDER

[Actions\Action2\Params]
expression=STRING|"datediff(""h"",cdate(""{c_date}""), now())"
variable=STRING|"DIFF"

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

[Actions\Action3\Params]
case=STRING|"0"
operator=STRING|"2"
type=STRING|"1"
value1=STRING|"{diff}"
value2=STRING|"24"

[Actions\Action4]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action4\Params]
message=STRING|"File {c_file} older than 24 hours ({diff} hours)"
type=STRING|"3"

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

[Actions\Action6]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
gumby69
Posts: 6
Joined: Fri Dec 11, 2009 8:10 am

Auto deleting.

Post by gumby69 »

Thanks Oleg much appreciated.
Last edited by gumby69 on Thu Dec 17, 2009 2:22 pm, edited 1 time in total.
Post Reply