Monitor File Size

Discuss RoboTask here
Post Reply
smiffer
Posts: 2
Joined: Wed Nov 07, 2007 3:50 am

Monitor File Size

Post by smiffer »

I'm new to RoboTask and need a little help. I'd like to monitor a folder and if a certain file size is greater than 100KB FTP the file. I found the File Monitor but that checks if the size has changed. I would like to monitor and if the file size is greater than 100KB then upload the file via FTP.
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Monitor File Size

Post by Oleg »

Look at my example below.
I think the algorithm is clear.
You have to get the list from FTP and compare file size with size of local file (VB Evaluate action)
If the size is greater than FTP size on 100K upload it.

Also attach the Cyclic trigger to run this task every hour

Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Look at the task in the task editor and correct it for your own purposes.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1360203151
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task39"
Hide=INTEGER|0
ID=INTEGER|1883862383
LogOnAsUser=INTEGER|1
Name=STRING|"uppload files is it greater the FTP file on 100K"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""FTPFOLDER"" with value ""/incoming"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"FTPFOLDER"
varvalue=STRING|"/incoming"

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

[Actions\Action11]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action12]
ActionID=STRING|"A_SSLFTP_LOGOFF"
Enabled=INTEGER|-1
Name=STRING|"SSL FTP Log Off"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""LOCALFOLDER"" with value ""c:\toupload"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"LOCALFOLDER"
varvalue=STRING|"c:\toupload"

[Actions\Action3]
ActionID=STRING|"A_SSLFTP_LOGON"
Enabled=INTEGER|-1
Name=STRING|"SSL FTP Log On"
Params=FOLDER

[Actions\Action3\Params]
anonymous=STRING|"1"
host=STRING|"ftp.myserver.com"
passive=STRING|"1"
password=STRING|"42310383162884337286400984055142142"
port=STRING|"21"
proxypassword=STRING|"2565724937259662673825194"
proxytype=STRING|"3"
tlsmode=STRING|"0"
useproxy=STRING|"0"
username=STRING|"anonymous"
usessl2=STRING|"0"
usessl3=STRING|"0"
usestls=STRING|"1"

[Actions\Action4]
ActionID=STRING|"A_SFTP_DIR"
Enabled=INTEGER|-1
Name=STRING|"SFTP File loop"
Params=FOLDER

[Actions\Action4\Params]
createmode=STRING|"1"
date1=STRING|"18991230"
date2=STRING|"18991230"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
filenameonly=STRING|"1"
folder=STRING|"{ftpfolder}/*.*"
kind=STRING|"0"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
sizesave=STRING|"1"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subfolders=STRING|"0"
timesave=STRING|"0"
varname=STRING|"FTPFILE"
varsize=STRING|"FTPSIZE"

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

[Actions\Action5\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{FileExists({LocalFolder}\{FTPFile})}"

[Actions\Action6]
ActionID=STRING|"A_SCRIPT_VBEVALUATE"
Enabled=INTEGER|-1
Name=STRING|"VB Evaluate"
Params=FOLDER

[Actions\Action6\Params]
expression=STRING|"{FileSize({LocalFolder}\{FTPFile})} - {FTPSize}"
linecount=STRING|"0"
loadfromfile=STRING|"1"
variable=STRING|"delta"

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

[Actions\Action7\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"3"
type=STRING|"1"
value1=STRING|"{Delta}"
value2=STRING|"100000"

[Actions\Action8]
ActionID=STRING|"A_SSLFTP_UPLOAD"
Enabled=INTEGER|-1
Name=STRING|"SSL FTP Upload"
Params=FOLDER

[Actions\Action8\Params]
file=STRING|"{LocalFolder}\{FTPFile}"
folder=STRING|"{FTPFolder}"
ifexists=STRING|"0"

[Actions\Action9]
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
UniqueID=INTEGER|-1560453937

[Events\Event1\Params]
interval=STRING|"3600"
notsatrtatactivation=STRING|"1"
Oleg Yershov
Post Reply