Mqtt cli - trying to use "sub -of <filename>" to send messages to file

Here is the command I am using once connected to my cluster from the “mqtt-cli-shell.cmd”

cursor> sub -t test -of C:\MQTT_Brokers\HiveMQClient\test.txt

I publish a topic and check the file and it remains empty. Is my path format wrong?

What am I missing?

Hi @meuste

I tested in my local.
The following command does not works as expected (read on why I meant as expected).

Shell Cursor> sub -t test -of C:\temp\test.txt

But this works

Shell Cursor> sub -t test -of test.txt

Basically the full path is not working. even though if you specify full path, it will remove the folder separator and drive and then create file with rest.

May be the way we need to specify the full path is not correct.

Content of the temptest.txt

Content of the test.txt

Thanks & Regards,

Yes! That worked using the cloud cluster. Seems we are just able to write to the install folder then. We can deal with that I think, but it would be nice to provide a full path to where other data files are kept.
Thank you, Venkat. Thanks for the help.

Hi @meuste,

Great that you have raised this question and brought this issue to our attention! Our software engineers assessed the behaviour of the –outputToFile option and agree it is not working as expected right now. We cannot promise exactly when, but you can expect it to be fixed in one of the future versions of the MQTT-CLI.

As a workaround we suggest you to create the output file first and then use its file name as a parameter of the –outputToFile option. This way you can use the path and have the file in particular directory, not only the current directory.

Let me know if this was helpful,

Kind regards,

Dasha from HiveMQ Support