unetstack

How to transmit a file located in an arbitrary path using: RemoteFilePutReq


I'm working on sending a file from one node to another using the Remote service in Python:

remote << RemoteFilePutReq(to=self.recipient, filename=self.file_name)

I find the file should be located in the "scripts" folder.

Is there any way to transmit a file located in an arbitrary path using: RemoteFilePutReq?


Solution

  • The file location is resolved with respect to the parameter remote.cwd. The default value for remote.cwd is scripts and so, your file is expected to be in the scripts folder. But you can change the location by changing the value of remote.cwd.

    For example, in the modem's Groovy web shell:

    > remote.cwd
    scripts
    > remote.cwd = new File('/tmp')
    /tmp
    > remote.cwd
    /tmp
    

    will setup the modem to look for files in /tmp instead of scripts.