Move a File From a selected Directory to another Directory.

Feb 5, 2013 at 8:44 PM
Hey Guys,
im new to this Project and my English Skills aren't the best cause Im not a native Speaker.I got the problem that i cant move Files from a Directory to another Directory. Everytime when I want to move a File I get an Exception.

Here is my Code Snippet
SftpClient sctmp=new SftpClient("","","");
                  sctmp.Connect();
                   
                  sctmp.Get(source).MoveTo(Dest);
                  sctmp.Disconnect();
I removed the Data for my Connection.My Connection dont fail cause i can get the list of Directorys and Files.

And Here is my Exception
Failure
   bei Renci.SshNet.Sftp.SftpSession.RequestRename(String oldPath, String newPath)
   bei Renci.SshNet.Sftp.SftpFile.MoveTo(String destFileName)
   bei SolidsSFTP.RemoteFile.movefile(String source, String Dest)
I hope u can help me and thanks for your feedback.

Greetings
SolidNerd
Coordinator
Feb 5, 2013 at 10:04 PM
Hi,

It seems like you doing it right but server for some reason returns "Failure" error.
It might be due to the wrong path, file does not exists, permission etc'.

might have a problem there but will need to know exact source and Dest names to try and recreate problem here.

Hope it helps,
Thanks,
Oleg
Feb 6, 2013 at 7:47 AM
Edited Feb 6, 2013 at 7:53 AM
Thanks for your fast feedback. I can get this fix by myself.I must ste a new Name for my File in the Destination String.

But now I get an SSHConnectionException after moveing an File is that normal ? The File is moved and my Connection get Closed.
Coordinator
Feb 6, 2013 at 1:20 PM
Hi,

I usually try to say what the reason for SshConnectionException. What else does it say?
Often it happens because server disconnects the connection for whatever reason. Sometimes for protocol issues which I can solve and sometimes for something else that I will need to investigate.

Thanks,
Oleg