FTP FILE LOOP

Discuss RoboTask here
Post Reply
Robert Daggar
Posts: 9
Joined: Mon Dec 20, 2004 12:33 pm

FTP FILE LOOP

Post by Robert Daggar »

I am trying to automate update of my files so that all files on my local PC are transferred to my FTP server.
 
Rather than simply transfer all files every night, I perform a file loop for the last 14 days, and check each file in this list to see if it is already on the FTP server. This is done using an FTP FILE loop within a FILE loop
 
However, when the FTP loop is used in this way - within a FILE loop - the pFTP file pointer is not reset for each new file. Instead, the FTP FILE LOOP makes a single pass thru the designated files list then generates end-of-loop.
 
IS there any way to reset the FTP FILE LOOP so that it is rebuilt for each file in the file loop.
 
 
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

FTP FILE LOOP

Post by Oleg »

It is small defect. When you use a nested loops, an internal loop can't use new values of parameters. We already prepare new release of RoboTask, where this trouble is eliminated.

For solution of your problem I have created two tasks (it is examples, see below):
1-st do a file loop and launches 2-nd task within loop
2-nd do FTP loop and upload a file, if one doesn't exists

After import these tasks, check "Start task" action in 1-st task, because at importing of tasks RoboTask assign a new IDs.
You should run "FTP synchronise (1-st)" task.

;1-st task
;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|565106205
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task224"
Hide=INTEGER|0
ID=INTEGER|269535259
Name=STRING|"FTP synchronise (1-st)"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=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|"20050223"
date2=STRING|"20050223"
destvar=STRING|"FILE_MASK"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"d:\source\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_TASKS_START"
Enabled=INTEGER|-1
Name=STRING|"Start Task ""FTP synchronise (2-nd)"""
Params=FOLDER

[Actions\Action2\Params]
taskid=STRING|"1788699300"
wait=STRING|"1"

[Actions\Action3]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
;end of 1-st task

;2-nt task
;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|565106205
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task225"
Hide=INTEGER|0
ID=INTEGER|1788699300
Name=STRING|"FTP synchronise (2-nd)"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

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

[Actions\Action1]
ActionID=STRING|"A_FTP_LOGON"
Enabled=INTEGER|-1
Name=STRING|"FTP Log On"
Params=FOLDER

[Actions\Action1\Params]
anonymous=STRING|"1"
host=STRING|"localhost"
passive=STRING|"0"
password=STRING|"4231738316406194034628830408604112640602242 423831112461"
port=STRING|"21"
username=STRING|"anonymous"

[Actions\Action10]
ActionID=STRING|"A_FTP_LOGOFF"
Enabled=INTEGER|-1
Name=STRING|"FTP Log Off"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FILE_EXISTS"" with value ""false"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"FILE_EXISTS"
varvalue=STRING|"false"

[Actions\Action3]
ActionID=STRING|"A_FTP_FILELOOP"
Enabled=INTEGER|-1
Name=STRING|"FTP File Loop"
Params=FOLDER

[Actions\Action3\Params]
filenameonly=STRING|"0"
folder=STRING|"{file_mask}"
sizesave=STRING|"0"
subfolders=STRING|"0"
timesave=STRING|"0"

[Actions\Action4]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FILE_EXISTS"" with value ""true"""
Params=FOLDER

[Actions\Action4\Params]
expand=STRING|"0"
varname=STRING|"FILE_EXISTS"
varvalue=STRING|"true"

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

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

[Actions\Action6\Params]
case=STRING|"0"
operator=STRING|"1"
type=STRING|"3"
value1=STRING|"{file_exists}"

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

[Actions\Action7\Params]
message=STRING|"File {file_mask} doesn't exists. Uploading..."
type=STRING|"1"

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

[Actions\Action8\Params]
file=STRING|"d:\source\{file_mask}"
folder=STRING|"./"

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

;end of 2-nd task
Post Reply