Copy a local file to a shared folder with password

Hi, im using node-red on windows and want to do this.
I'm looking for a way to copy a video file from a local folder to a shared folder on the network using node-red. The problem is that with CMD, being previously connected does not ask for a password and I can do it manually, but from node-network I do not know how to access this folder

I tried the nodes fs ops and I was looking scp2 in npm web too

I have been programming for only a few months and I would like to learn more, if you know another better method it also helps me

Is this a Windows Shared Folder? If so, the authentication will be Windows auth and once you have authenticated, you shouldn't need to do it again until the system reboots. You should also be able to save the credentials so you never have to do it again.

Thanks for answering
Then I do not need to re-enter the password...
In the CMD of Windows it goes well.
But when I use the exec node to use the copy command in this folder it says:
<command error: (name of the folder) access denied>

I have also tried with the node fs ops and it says "Error: EPERM: operation not allowed"

I do not know if I'm doing something wrong or there's any other way to do this

What account runs node-red? It's likely that account doesn't have access to the src or destination folder. Run a command prompt as that user and try the copy again.

I think you will need to share the commands you are using.

Using the command prompt node-red send me a blank message

it may be possible that you do not have access to the user from node-red?


I've tried in cmd with copy, robocopy and things with netstat for things that I was looking for

I found an SMB node that allows me to access the folder from node-red to modify it but it does not let me move or copy a local file to this folder.

Have you got the command working from the shell (command line) first?

You need to make sure that you can do that before trying in Node-RED.

You also should make sure you are using absolute file paths - e.g. /one/two/three.txt - instead of relative paths (without the leading / in this example). Once you move the command to Node-RED, you will have a different working directory so relative paths are often hard to work out.

1 Like

In the windows terminal the command works correctly. What happens is when I try to use a command like xcopy, copy or robocopy from node-red it tells me that the directory is not valid or that it could not be found. I have reviewed several times if it is well written and I do not see the fault.
When copying the file from windows CMD to this shared folder on the network, it works correctly. Since node-red does not

With the CD command I can see that the command is executed from the folder of my user C: \ Users \ NXito \ .node-red

It would help if you could share your command. Hard to 2nd guess these things.

I already managed to solve it.
Thank you for helping me, i understand now about what was wrong
The bug was that node-network was not connecting to the shared folder and the copy command of the cmd did not work.
Start testing the "Net Use" command in node-red and register the shared folder there:
net use \ sharedfolder / u: User password
In the end if it is important to re-enter the password

Then I checked with net use that node-network was connected to that folder and now the copy command already worked:
copy c:\one\two\three.mp4 \sharedfolder\newfolder

Now i can use the node FS OPS to work with files too

Can you share flow for this?