node-ftps icon indicating copy to clipboard operation
node-ftps copied to clipboard

Error in path when uploading

Open zaghop opened this issue 5 years ago • 3 comments

I am attempting to transfer a file using SFTP on a windows machine. When the package attempts to send the file, it is using an incorrect path. I am passing in the full path location, but it is appending the following to the beginning of the path.

"/cygdrive/c/Scripts/file-mover/"

The script is located in C:/Scripts/file-mover. For example, if I pass in a filename of "C:/Temp/thisfile.txt" the error that I see is as follows:

{ error: 'put: /cygdrive/c/Scripts/file-mover/C:/Temp/thisfile.txt: No such file or directory\n', data: '' }

Is there a way to prevent this?

zaghop avatar May 13 '19 18:05 zaghop

Hi, Any update on this issue?

psuresh246 avatar Feb 02 '20 09:02 psuresh246

I have the same problem

tirilo555 avatar Mar 08 '23 20:03 tirilo555

ftps is used in unix environments, so its expecting the path to be in /cygdrive/c

Converting the windows path to unix path should be able to fix this issue.

const convertPathToUnix = (windowsPath) => { return windowsPath.replace(/\/g, '/').replace(/^([a-zA-Z]):/, '/cygdrive/$1'); };

Akshatha1700 avatar Jul 10 '24 05:07 Akshatha1700