I just cannot get this to work.
identify of MT device is: 125-hAP
The script creates the file:
125-hAP_2024-04-07 .txt
Including the underline characters at the beginning and end of the file
But the fetch command cannot find the file.
/system
:local cdate [clock get date]
:local yyyy [:pick $cdate 0 4]
:local MM [:pick $cdate 5 7]
:local dd [:pick $cdate 8 10]
:local identitydate "$[identity get name]_$yyyy-$MM-$dd"
/ip/address print file="[$identitydate]"
/tool fetch upload=yes mode=ftp ascii=no src-path="[$identitydate].txt" dst-path="/mikrotik-backups/$[$identitydate].txt" address=192.168.2.22 port=21 user=mikrotik password=mikrotik
/file remove "[$identitydate]"
Also tried the /tool fetch command with src-path=“$[$identitydate].txt”
As well as without the .txt
Did something change in the scripting over the past several RouterOS updates?
Thanks!
Amm0
April 7, 2024, 4:09pm
2
There were some recent builds that “sanitized” the file names. In latest 7.15beta9, it returns to the “old” behavior.
*) console - added “sanitize-names” property under “/console/settings” menu (option for replacing reserved characters with underscores for files, disabled by default);
I don’t know what sanitize means in this context?
I’m sure there was no version that would have given be a health problem (except maybe psychological problems).
Amm0
April 7, 2024, 5:16pm
4
Specifically, v7.13 and v7.14 have this changes:
*) console - replace reserved characters in file and script names with underscores;
So sanitize means remove spaces and special characters. The reverted this as a default in 7.15 beta.
*) console - replace reserved characters in file and script names with underscores;
Wow, as if the proper usage of “$” and “[” weren’t complicated enough in filenames/variable-names.
Amm0
April 7, 2024, 5:36pm
6
And changing things in different versions really does add even more complexity. That’s why they reverted recently I suspect.