Code: Select all
:local ftpserver "xxx.xxx.com"
:local username "username"
:local password "password"
:local remotepath "router_updates/router_updates.rsc"
:local localpath "router_updates.rsc"
/tool fetch mode=ftp address=$ftpserver src-path=$remotepath user=$username password=$password dst-path=$localpath keep-result=yes
# Check if the file exists
:local file [/file find name="router_updates.rsc"]
:if ([:len $file] > 0) do={
# File exists, do something
:log info "Update file found."
:delay 5s
/import router_updates.rsc
:delay 5s
/file remove "router_updates.rsc"
} else={
:log info "No updates available."
}