I am getting "Output: [Cannot overwrite remote file " message while writing files to sftp server using "$session.PutFiles"
I am uploading the files using WinSCP .NET assembly.
I noticed that file upload is failing when I create a directory using "$session.CreateDirectory($remotePath)" and then load data to this directory using "$session.PutFiles".
Directory path is getting created, but files are not getting uploaded.
If I try uploading files to other directory path which already exists, then it is uploading. Only for new directory created, files are not uploading.
Error message in log file:
Output: [winscp> put -delete -nopermissions -preservetime -transfer="binary" -- "<Source local file path>" "<destination vm file path>"]
Output: [Cannot overwrite remote file '<destination vm file path>'.]
Scheduling output: [General failure (server should provide error description).]
Scheduling output: [Error code: 4]
Scheduling output: [Error message from server: Failure]
Scheduling output: [Common reasons for the Error code 4 are:]
Scheduling output: [- Renaming a file to a name of already existing file.]
Scheduling output: [- Creating a directory that already exists.]
Scheduling output: [- Moving a remote file to a different filesystem (HDD).]
Scheduling output: [- Uploading a file to a full filesystem (HDD).]
Scheduling output: [- Exceeding a user disk quota.]