Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Below is the code i used to write the file on my destination folder , howerver by some logic if same file i want to create having some different data into it , it gets overwritten on that location , my requirement is not to overwrite the file , but keep the old file as it is and creating new file having similar name but buy just appending next copy to it .. ex my_file.pdf(1) or something like that

C#
ProcessStartInfo startInfo = new ProcessStartInfo();
                    string switches = "";
                    switches += "--header-html " + path + " --footer-html " + footerPath;// + " --header-spacing 10";
                    startInfo.UseShellExecute = false;

                    startInfo.RedirectStandardOutput = true;

                    startInfo.RedirectStandardInput = true;

                    startInfo.RedirectStandardError = true;

                    startInfo.CreateNoWindow = true;

                    startInfo.FileName = Server.MapPath(ConfigurationManager.AppSettings["wkhtmltopdfsetup"].ToString());

                    startInfo.Arguments = switches + " " + website + " " + destinationFile;



                    Process myProcess = Process.Start(startInfo);
                    string error = myProcess.StandardError.ReadToEnd();
                    myProcess.WaitForExit();
                    myProcess.Close();
                    myProcess.Dispose();
                    myProcess = null;
Posted
Updated 10-Mar-15 23:30pm
v2
Comments
OriginalGriff 11-Mar-15 5:34am    
And?
What have you tried?
Where are you stuck?
What help do you need?
Torakami 11-Mar-15 6:57am    
the above code is what i am using ... the peoblem is when i call same method to write the same file which might contain other contents into it it gets overwritten with old file .. and dont want that to happen
OriginalGriff 11-Mar-15 9:51am    
But the above code doesn't do any of that - so what have you done to actually implement what you want? Anything?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900