如何使用 SharpSSH 将文件移动到 SFTP 服务器
How to Move a file to SFTP server using SharpSSH
需要使用 Tamir.SharpSsh.Sftp.
在 filezilla 上将文件从一个文件夹移动到另一个文件夹
Tamir.SharpSsh.Sftp client = new Tamir.SharpSsh.Sftp(address, username, password);
client.Connect();
client.? // for move file from one folder to another
这是我前段时间编写的代码的摘录
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);
}
试试这个...
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 ... }
在 *nix 操作系统上,移动和重命名是同义词。 sftp好像继承了这个设计
需要使用 Tamir.SharpSsh.Sftp.
在 filezilla 上将文件从一个文件夹移动到另一个文件夹 Tamir.SharpSsh.Sftp client = new Tamir.SharpSsh.Sftp(address, username, password);
client.Connect();
client.? // for move file from one folder to another
这是我前段时间编写的代码的摘录
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);
}
试试这个...
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 ... }
在 *nix 操作系统上,移动和重命名是同义词。 sftp好像继承了这个设计