Reputation: 44
need to move file from one folder to another on filezilla using Tamir.SharpSsh.Sftp.
Tamir.SharpSsh.Sftp client = new Tamir.SharpSsh.Sftp(address, username, password);
client.Connect();
client.? // for move file from one folder to another
Upvotes: 2
Views: 9346
Reputation: 26766
Try this...
Tamir.SharpSsh.Sftp client = new Tamir.SharpSsh.Sftp(address, username, password);
client.Connect();
if(client.Connected) {
client.Rename("/source/path/file.zip", "/destination/path/file.zip");
} else {throw new ... }
On *nix OSes, move and rename are synonymous. Sftp seems to have inherited the design.
Upvotes: 4
Reputation: 401
Heres an extract from code i worked on a while ago
try{
Tamir.SharpSsh.Sftp secureFtp;
secureFtp = new Tamir.SharpSsh.Sftp(ServerPath, username, password);
Console.WriteLine("connecting");
secureFtp.Connect();
if(secureFtp.Connected)
{
Console.WriteLine("Connected");
secureFtp.Put(Targetpath_filename, DestinationPath_filename);
//Targetpath_filename = "C:\somepath\somefile.extension
//DestinationPath_filename = "/in/somefilename.extension" or whatever the ftp path is
}
else
{
Console.WriteLine("Error connecting");}
}
catch(Exception E)
{
Console.WriteLine(E.Message);
}
Upvotes: 0