file value-name=contents don't works :(

(RouterOs 5.14 and 5.8 tested)
I try it with several files and several scripts

:local content [ /file get [ /file find name=console-dump.txt] value-name=contents ]
:local contentLen [:len $content ]

but len is always 0, and contents is always empty.
If I read name, file len, or other value-names, then works fine, but not with contents

Why???
Thanks

try this

:put [file get number=console-dump.txt contents]

and

:put [:len [file get number=console-dump.txt contents]]

According to fewi, variables can’t be larger than 4096 bytes:
http://forum.mikrotik.com/t/how-can-i-write-script-output-to-a-file/38551/1

I tested your code, and it worked just fine for me as long as the file size was less than 4096 bytes. Anything larger than that and I got a length of 0, just like you were seeing.

ok, thanks! :slight_smile: