<pre lang="c#"> SftpClient sftpClient = new SftpClient("xx.xxx.xxx.xxx", "root", "************"); sftpClient.Connect(); var newLines = new List<string>(); string[] oldlines = sftpClient.ReadAllLines("/sftp/sftpuser/test.txt"); int index = 0; foreach(string line in oldlines) { if (line.Equals("Match user sftpuser")) { break; } index++; } int[] indexdelete = { index, index + 1, index + 2, index + 3 }; for(int i =0; i < oldlines.Length; i++) { if (indexdelete.Contains(i)) continue; newLines.Add(oldlines[i]); } sftpClient.WriteAllLines("/sftp/sftpuser/test.txt", newLines); sftpClient.Disconnect();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)