On several occasions I have to push multiple files that are inside RouterOS files and I always end up having to use foreach to do this. Or even worst... Do it manually.
It would be faster, simpler, and more economical in time and resources if you could do this using a Linux regular expression to define the files.
Instead of:
/tool fetch upload=yes src-path=file1.txt
/tool fetch upload=yes src-path=file2.txt
/tool fetch upload=yes src-path=file3.txt
/tool fetch upload=yes src-path=file4.txt
/tool fetch upload=yes src-path=file5.txt
Use something similar to:
/tool fetch upload=yes src-path=file*.txt
Is this already possible today?
If yes, how?
If not, why not?
P.S.: To me it seems like it was something like: "This was the way to prevent the user from doing stupid things like bringing into an RB750 thousand files due to a wrong command."
Just for reference, here's a jerryrig I pulled out of my sleeve at some point, and I've been using it ever since.
P.S.: Is it ugly? YES!
Does it work? Poorly, with one connection for each file, but YES! IT WORKS!
... and then you protest when AI hallucinates, I wouldn't be surprised if most of the (non-existing) syntax often output from AI comes from these hypothetical syntaxes posted here and there as if they were real things ...
The LSP/MCP MikroTik Syntax created by our forum colleague should be input as the major reference for all IAs/LLMs.
There is something close to "robots.txt" that a companies can publish "official" information's like syntax reference?
so statement in 1st post was not entirely true because usually there is no “Eureka” moment when doing something in regular manner
PS.
If your case is to transfer multiple files over sftp and avoid using fetch in iteration, you may try with sshfs disk mount, it should use single connection.
As far as I know, /tool fetch still doesn’t support wildcard expansion like file*.txt directly, so the usual approach is still looping through files with foreach.
Honestly, it would be pretty useful though, especially for automation-heavy setups. I can also understand why MikroTik may have avoided it originally — one bad pattern match on a small router could suddenly trigger way more file operations than intended.
A lot of scripting limitations like this end up being less about syntax and more about keeping resource usage predictable on lower-end hardware.
Haha honestly I’d probably use that mode too. Sometimes it feels like RouterOS is trying a little too hard to protect us from ourselves
An optional “I know what I’m doing” override for advanced users would actually be pretty useful for automation-heavy setups where the current workarounds end up being more annoying than risky.