arammal
September 4, 2020, 7:54am
1
Hello,
Im writing a scrip to get packages from remote RouterOS using /tool fetch mode=ftp…, in src-path I need to wildcard the rest of name of package, example if package with name “routeros-mipsbe-6.47.2.npk” i need only to put in src-path “routeros-mipsbe-WHATEVER”, what shall i use?
Thanks in Advance.
You may be able to do this by using regex. Try something like this:
:foreach filename in=[/file find name ~ "routeros-mipsbe.*"] do={
/tool fetch mode=ftp ... src-path=[/file get $filename name]
}
arammal
September 4, 2020, 9:16am
3
Thank you for your quick reply.
this is my script but why did not run?
:foreach filename in=[/file find name ~ “routeros-mipsbe.*”] do={
/tool fetch mode=ftp upload=no address=x.x.x.x port=xx user=“x” password=“x” src-path=[/file get $filename name] dst-path=[/file get $filename name] keep result=yes
}
Thank you for your quick reply.
this is my script but why did not run?
:foreach filename in=[/file find name ~ “routeros-mipsbe.*”] do={
/tool fetch mode=ftp upload=no address=x.x.x.x port=xx user=“x” password=“x” src-path=[/file get $filename name] dst-path=[/file get $filename name] keep result=yes
}
You forgot the hyphen in keep-result=yes