I want to upload files to home (root) directory of the server, not into a folder.
How can I do it? (using C#)
transferResult = session.PutFiles(path, "\\", true, transferOptions);
If I use \\
for remotePath
, uploaded file was renamed.
I want to upload files to home (root) directory of the server, not into a folder.
How can I do it? (using C#)
transferResult = session.PutFiles(path, "\\", true, transferOptions);
If I use \\
for remotePath
, uploaded file was renamed.
Remote paths typically use Unix convention with forward-slashes, not Windows back-slashes.
Moreover using a slash only denotes a root folder, not a home folder (unless your account is chrooted).
Ideally use an absolute path to the home folder:
session.PutFiles(path, "/home/user/", ...);
For chrooted account that would be a slash only (this is a general comment, I see it's not your case):
session.PutFiles(path, "/", ...);
You can also use the "./"
to refer to an initial (home) directory.
session.PutFiles(path, "./", ...);
You can also use the Session.HomePath
:
session.PutFiles(path, session.HomePath + "/", ...);
Cannot overwrite remote file '/JKH_MCEFT_11172014 33502 PM.txt'. Error Upload Files : Cannot overwrite remote file '/JKH_MCEFT_11172014 33502 PM.txt'. Press 'Delete' to delete the file and create new one instead of overwriting it. Error: WinSCP.SessionRemoteException: Cannot overwrite remote file '/JKH_MCEFT_11172014 33502 PM.txt'. Press 'Delete' to delete the file and create new one instead of overwriting it. ---> WinSCP.SessionRemoteException: No such file or directory. Error code: 2
– Suravi Nov 17 '14 at 11:56