Hello ,
I’m trying to transfer some files using the FTP command
I have manage to transfer 1 file with 1 name
but how can I upload all the files I have?
I have many log files I save in the router
061014.log
051014.log
250914.log
so how can I upload *.log ?
or even write a script of something like
foreach i in[/file] do={/system script run ftpsend};
or something like this?
I got stuck on this
foreach i in=[/file print count-only ] do={:put $i}
I get on the print -1 , why ? I think this is my problem - how can I see the amount of file I have ?then I will be able to run the script as many time as the files I have - no?
just need 1 more help
I want it to run automatic , and when there are no files (meaning $i=0) will send me massage
but it doesn’t work
can you see why?
:local RemoteFTP 10.0.0.6;
:local User ftp;
:local Pass ftp;
:put "Sending the file";
foreach i in=[/file find where type=".raw file"] do={:if ($i=0) do={log warning "No file to send";} else={:local last [/file get number=$i name];/tool fetch upload=yes mode=ftp address=$RemoteFTP user=$User password=$Pass src-path=$last dst-path=$last ;log warning "last upload file $last"; [file remove numbers=$i]}};
:put "DONE";
:log warning "FINISH UPLOAD FILES!!!";