BLO access to the files of the Server

Hello,
I want to attach files to a site. For this there is the function sendFile in the rapidStudio.

Now I need to get the files from a location of the server. How can I access the local files (file system) of the server with the BLO of the rapidStudio.

kind regards
Johannes

Hello Johannes,

In the function

sendFile( path, file, params)

the “file” parameter can contain the absolute path to your file in the local file system on the server.
For details, see also the documentation of the sendFile() function in the online help of the rapidM2M Studio.

Best regards
Franz

Hello Franz,
that I know and I already have it working.

My current problem is that I get the files into a folder on the server but I don’t know the exact file names. Just in which folder their saved.

Is there a way to get the filenames of all the files in the folder into the BLO script in the rapidStudio?

And also maybe move the file after importing them to a new folder.

Kind regards
Johannes

Hello Johannes,
to list all files of a directory, you can use the fs module of nodejs.
The function you are looking for is the readdir and for moving the rename function.

For easier usage of the file functions you can also use the fs-extra module from npm.

Kind regards,
Jakob