I were solved this problem by adding list of file as command argument.
My Code
public static string RarFilesT(string rarPackagePath, Dictionary<int,> accFiles)
{
string error = "";
try
{
string[] files = new string[accFiles.Count];
int i = 0;
foreach (var fList_item in accFiles)
{
files[i] = "\"" + fList_item.Value;
i++;
}
string fileList = string.Join("\" ", files);
fileList += "\"";
System.Diagnostics.ProcessStartInfo sdp = new System.Diagnostics.ProcessStartInfo();
string cmdArgs = string.Format("A {0} {1} -ep1 -r",
String.Format("\"{0}\"", rarPackagePath),
fileList);
sdp.ErrorDialog = true;
sdp.UseShellExecute = true;
sdp.Arguments = cmdArgs;
sdp.FileName = rarPath;
sdp.CreateNoWindow = false;
sdp.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
System.Diagnostics.Process process = System.Diagnostics.Process.Start(sdp);
process.WaitForExit();
error = "OK";
}
catch (Exception ex)
{
error = ex.Message;
}
return error;
}
private void btnSave_Click(object sender, EventArgs e)
{
Dictionary<int,> accFiles = new Dictionary<int,>();
accFiles.Add(1, @"D:\New folder\New folder\*.txt");
accFiles.Add(2, @"D:\New folder\*.html");
RarFilesT(@"D:\test.rar",accFiles );
}