private void CopyLogErrorFile2SharedFolder(string nomefileErr) { //copy log_error file into _sharedOutputFolder if (String.IsNullOrEmpty(nomefileErr)) { return; } var machinePingable = PingTest.PingHost(_hostPath, _logger, _timeout); if (machinePingable) { if (Directory.Exists(@"\\" + _sharedOutputFolder)) { if (Directory.Exists(Path.Combine(@"\\" + _sharedOutputFolder, _lostFolder))) { _logger.LogInformation($"copy {nomefileErr} file into {_sharedOutputFolder}"); System.IO.File.Copy(nomefileErr, @"\\" + _sharedOutputFolder + @"\" + nomefileErr); } } else { _logger.LogError("Remote folder: " + @"\\" + _sharedOutputFolder + " not found"); } } else { _logger.LogError($"copy {nomefileErr} file into {_sharedOutputFolder} failed! Remote computer: {_hostPath} not found"); } }
//copy scarti_load file into _sharedOutputFolder private void CopyInSharedFolder(string pathFileName, string fileName) { //check if the machine contains the shared folder is reachable //var hostPath = _sharedOutputFolder.Split("\\"); var machinePingable = PingTest.PingHost(_hostPath, _logger, _timeout); var pathReportFile = new StringBuilder(_configuration["PathReportFile"]).Append(@"\").Append(@"\"); pathReportFile.Append(Path.GetFileName(fileName)).Append("-SCARTI_LOAD_").Append(Guid.NewGuid()).Append(".TXT"); if (machinePingable) { if (Directory.Exists(@"\\" + _sharedOutputFolder)) { _logger.LogInformation("copy " + fileName + $" file into {_sharedOutputFolder}"); System.IO.File.Copy(pathFileName, Path.Combine(@"\\" + _sharedOutputFolder, _lostFolder) + @"\\" + fileName); } else { _logger.LogError("Remote folder: " + @"\\" + _sharedOutputFolder + " not found"); } } else { _logger.LogError("copy " + fileName + $" file into {_sharedOutputFolder} failed! Remote computer: " + _hostPath + " not found"); } }
private void CopyOutcomesFile2SharedFolder(string outcomesFilename, string outputFileName) { //copy scarti_update file into _sharedOutputFolder var machinePingable = PingTest.PingHost(_hostPath, _logger, _timeout); if (machinePingable) { if (Directory.Exists(@"\\" + _sharedOutputFolder)) { if (Directory.Exists(Path.Combine(@"\\" + _sharedOutputFolder, _lostFolder))) { _logger.LogInformation($"copy {outputFileName} file into {_sharedOutputFolder}"); System.IO.File.Copy(outcomesFilename, Path.Combine(@"\\" + _sharedOutputFolder, _lostFolder) + @"\" + outputFileName); } } else { _logger.LogError("Remote folder: " + @"\\" + _sharedOutputFolder + " not found"); } } else { _logger.LogError($"copy {outputFileName} file into {_sharedOutputFolder} failed! Remote computer: {_hostPath} not found"); } }