How to copy files from SMB Share to SMB Share

Hello Guys,

It will be several weeks if not more than I tear my hair to make a file and directory copy with Node Red.
If someone can help me, my brain will really appreciate :rofl:

I expose my problem.

I run Node Red under Home Assistant (hassio) and I use a lot of sensors / detectors / lights / switch / Security cam with node red.

I want to copy (or move) my cam snapshot from home assistant directory (SMB Share) to my NAS (SMB Share "Synology & TrueNAS") to have a backup just in case and after my NAS will manage to push in the cloud.

I've try these following node without success :sleepy: :

-node-red-contrib-filebrowser
-node-red-contrib-fs-ops
-node-red-contrib-smb

**---**With SMB node I can read files or directory on my Home Assistant and NAS system without problem. I can create also file but I can't copy an existing file or folder.

**---**With fs-ops I can make a copy but only in local (home assistant to home assistant) and I can't do this operation in an SMB Share.

**---**With filebrowser I just don't understand how to use it, no documentation and I find nothing like what I want to do.

Maybe it's really simple but I've ask in a lot of different discord group and nobody know how to do, I've look a lot on the web also without success.

If someone can explain me how to easily copy few files and directory betwen SMB Share source & SMB Share destination or share a flow :innocent:

Thanks in advance for your help :wink:

Can your node-red actually contact the Nas? Install the ping node and verify that node-red can ping the Nas by name and / or IP.

You can use an exec node to run a system command to do the copy.

1 Like

I will repeat what I've said elsewhere on this subject. SMB is an operating system level feature. Make sure that you set up the shared drives at the OS level. Make sure you can then copy from the command line.

Then, if you are still having problems in Node-RED - it is a Home Assistant problem, not a Node-RED problem. Try running another instance of Node-RED without HA to prove that.

If you need to do filing system things in a function node, you can make Node.js's built in fs module available from settings.js in the globals section. You can then do const fs = global.get('fs') in your function node.

Yes I can read the content (files / directory) of the NAS SMB Share

Do you've an exemple of code for doing this action ?
That I can inspire myself.
Thanks

Maybe I misspoke.
I don't have any access or rights problem on my SMB shares.
I just don't know how and with what to make a copy between two smb shares via node red. :wink:
I will look for the function :slight_smile:

As stated, it is exactly the same as any other filing system copy. Node.JS makes the fs module available which you can load into a Node-RED global to have access in a function node. But something like fs-ops should work just fine.

You need to mount your SMB drives into the Linux filing system at a suitable mountpoint.

What do you mean an example of code? Just use an Exec node and run whatever system command you want to use. Though it would be better to do it the node-red way using one of the techniques suggested by others.

It's okay I've solve my problem, I can use Rsync now :wink:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.