How can I check to see if an FTP file exists or not? I see the FileExists command, but can you use it to look for an FTP file?
The problem is I am using the script to download yesterdays file, by date, but if the file does not exist the script is breaking instead of moving on. Any suggestions welcome
Thank you
--j
Does FTP File Exist?
Does FTP File Exist?
See example below. You can specify any file mask you want to find in FTP File Loop action.
Save text of task to file and use menu Task | Import to import into RoboTask
;**********************
;* RoboTask Task file *
;* Do not edit! *
;**********************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|817783733
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task330"
Hide=INTEGER|0
ID=INTEGER|88700190
Name=STRING|"Check file existence on FTP"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=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_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""No files on FTP!"""
Params=FOLDER
[Actions\Action10\Params]
icon=STRING|"3"
msg0=STRING|"No files on FTP!"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action11]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FTP_EXISTS"" with value ""false"""
Params=FOLDER
[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"FTP_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|"*.*"
sizesave=STRING|"0"
subfolders=STRING|"0"
timesave=STRING|"0"
varname=STRING|"FTP_FILE"
[Actions\Action4]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FTP_EXISTS"" with value ""true"""
Params=FOLDER
[Actions\Action4\Params]
expand=STRING|"0"
varname=STRING|"FTP_EXISTS"
varvalue=STRING|"true"
[Actions\Action5]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"
[Actions\Action6]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action7]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action7\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{ftp_exists}"
[Actions\Action8]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""At least one file exists on FTP"""
Params=FOLDER
[Actions\Action8\Params]
icon=STRING|"1"
msg0=STRING|"At least one file exists on FTP"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action9]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"
Save text of task to file and use menu Task | Import to import into RoboTask
;**********************
;* RoboTask Task file *
;* Do not edit! *
;**********************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|817783733
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task330"
Hide=INTEGER|0
ID=INTEGER|88700190
Name=STRING|"Check file existence on FTP"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=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_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""No files on FTP!"""
Params=FOLDER
[Actions\Action10\Params]
icon=STRING|"3"
msg0=STRING|"No files on FTP!"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action11]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FTP_EXISTS"" with value ""false"""
Params=FOLDER
[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"FTP_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|"*.*"
sizesave=STRING|"0"
subfolders=STRING|"0"
timesave=STRING|"0"
varname=STRING|"FTP_FILE"
[Actions\Action4]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FTP_EXISTS"" with value ""true"""
Params=FOLDER
[Actions\Action4\Params]
expand=STRING|"0"
varname=STRING|"FTP_EXISTS"
varvalue=STRING|"true"
[Actions\Action5]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"
[Actions\Action6]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action7]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action7\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{ftp_exists}"
[Actions\Action8]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""At least one file exists on FTP"""
Params=FOLDER
[Actions\Action8\Params]
icon=STRING|"1"
msg0=STRING|"At least one file exists on FTP"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action9]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"
Last edited by Oleg on Mon Nov 07, 2005 1:56 pm, edited 1 time in total.