private string CopyComparisonScript(string refHost, string refEnv) { string remoteScriptName = string.Empty; FtpConnection connection = new FtpConnection(refHost, "mxftp", "mxftp"); string localFileName = Path.GetTempFileName(); CommonUtils.WriteFile(localFileName, ComparisonScript); try { try { connection.Open(); //bgDoServerWork.ReportProgress(5, "Validating Results..."); } catch (Exception ex) { CommonUtils.ShowError(ex.Message, ex); } connection.Login(); connection.SetCurrentDirectory(refEnv); //Path.GetTempFileName remoteScriptName = Path.GetFileName(localFileName); connection.PutFile(localFileName); connection.RenameFile(remoteScriptName, Path.GetFileNameWithoutExtension(remoteScriptName) + ".sh"); //connection.SendCommand("chmod 777 " + Path.GetFileNameWithoutExtension(remoteScriptName) + ".sh"); remoteScriptName = Path.GetFileNameWithoutExtension(remoteScriptName) + ".sh"; } finally { connection.Close(); connection.Dispose(); } return remoteScriptName; }