node-ftps
node-ftps copied to clipboard
Error in path when uploading
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?
Hi, Any update on this issue?
I have the same problem
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'); };