public bool ftpMkdir(string remotePath) { try { if (!m_sshCp.Connected) { m_sshCp.Connect(); } //m_sshCp. String[] paths = remotePath.Split('/'); StringBuilder sb = new StringBuilder("/"); foreach (String a in paths) { if (!a.Equals("") && !a.Equals(paths[paths.Length - 1])) { sb.Append(a); Console.WriteLine(sb.ToString()); //m_sshCp. m_sshCp.Mkdir(sb.ToString()); sb.Append("/"); } } return(true); } catch (Exception ex) { Console.WriteLine("upload" + ex.Message); return(false); } }
public static bool SshFileMkDir(SshTransferProtocolBase sshCp, string FilePath, out string errMes) { errMes = null; try { sshCp.Mkdir(FilePath); return(true); } catch (Exception ex) { errMes = ex.Message; return(false); } }