Why /file get FILE contents on routeros 6 returns nothing?

Hi,

I’m trying to make the dyndns script to work. It doesn’t work. It creates the file but does not get the file contents. I’m using routeros 6 so I don’t know if it has some weird bug on /file.

Ex.:

[admin@trunetroutersp01] > /file print
 # NAME                   TYPE                        SIZE CREATION-TIME
 0 dyndns.checkip.html    .html file                   103 jun/05/2013 19:12:30
 1 pub                    directory                        jun/05/2013 15:41:10
 2 um-before-migration... .tar file                16.5KiB jan/01/1970 21:00:33
 3 trunetroutersp01-05... backup                   49.5KiB jun/05/2013 16:46:20
 4 skins                  directory                        dec/31/1969 21:00:41
[admin@trunetroutersp01] > /file get dyndns.checkip.html contents
[admin@trunetroutersp01] >

Other files prints nothing as well.

Any help will be very appreciated.

Thanks in advance,

Wagner Sartori Junior

put [/file get dyndns.checkip.html contents]

Hello,

Running 6.34.4 - I am not able to read content of a file with:

:put [/file get [/file find where name=ch-aggregated.zone] contents ]

The file is coming from http://www.ipdeny.com/ipblocks/data/aggregated/ch-aggregated.zone and has been fetched with /tool fetch

Any help will, of course, be appreciated :slight_smile:

Thank you

Edit:
OK I found this post http://forum.mikrotik.com/t/file-edit-content-shows-empty-content/89306/1 saying that files >4kb can’t be edited.
Fine - How do I get content line by line, don’t tell me it’s impossible :confused:

Edit2:
Impossible: http://forum.mikrotik.com/t/cant-read-file-large-then-4085-bytes/37312/1
4kb sounds like ridiculous size for a RB1100AHx2.

The mechanism is apparently only for small configuration data that can be read in a single read call.
(in fact it can search for something in the file and return the matching data, still in a single read)

What you would require is a more generic mechanism that.

  1. opens a file and returns a file handle
  2. reads the file line by line (handle is a parameter, one line is stored in a variable)
  3. closes the file specified by that handle

Alas, is does not work like that…

I wanted to have something standalone on the Mikrotik but I’ll use a side device to fetch the file and upload chunks of them and then run a script :open_mouth: