sanath avua

sanath avua

  • NA
  • 5
  • 482

while processing file from source to destination using prss?

Apr 18 2017 10:34 AM

while processing file from source path to destination path using process.StartInfo ,getting an error file not found.

I have pasted source code in below.plesase look the commented lines as well.

could you please help to resolve the error.

public string submitFile(string SourceFilePath, string CWID, string SystemName, string destFileName, string fileType)
{
string strresult = "";
try
{
string strDestPath = _configurationManager.AppSettings["Attachmentpath"];
if (SystemName.Trim() == "xvalue")
{
string BatfilePath = _configurationManager.AppSettings["BatFilePath"];

if (File.Exists(SourceFilePath))
{
destFileName = destFileName.Replace("\"", "");
string DestinationFilePath = "\"" + strDestPath + "\\" + CWID + "_" + destFileName + "." + fileType + "\"";
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = BatfilePath + "Unzip.bat";
process.StartInfo.UseShellExecute = false;
//here maping sourec and destination paths like below :-
//SourceFilePath = D:\Data\CWAttachment\test.txt
//DestinationFilePath; D:\RetValue\CWAttachment\cW123_test.txt
process.StartInfo.Arguments = SourceFilePath + "\t" + DestinationFilePath;

process.Start();//this place i am getting an error
process.WaitForExit();
strresult = "Processed";
}
else
{
strresult = "FileNotFound";
}
}
}
catch (Exception ex)
{
//Log.Error("Error occured while submitFile an CWAttachmentInfo ", ex);
}
return strresult;
}

Answers (1)