Win Surprise Gifts!!!
Top 5 Contributors of the Month
Post New Question
Subscribe to Forum
Merge a Files in C#.net
March 05, 2012
How to append a files in the C#.net? I have a Input Folder and 4 txt files in the Input Folder. i want to merge/Append a files in the same folder and Appended files will delete after appending .
Folder name: Test
File Names are
3 ) 2012_03_05_05:50:40.txt
4 ) 2012_03_05_05:50:45.txt. here there are 4 files in the Test Folder . I want to append a files into 1st file and Automatically. 2nd,3rd,4th file should be deleted after Appending or merge a files .How can i achieve this?
Posted Date: March 07, 2012 Points: 20
See the following code....
string sPath = "d:\\temp";
string sFileType = "*.txt";
string sAppendFile = "Append.txt";
foreach (string fileName in Directory.GetFiles(sPath, sFileType))
if (fileName != sAppendFile)
File.AppendAllText(Path.Combine(sPath, sAppendFile), File.ReadAllText(Path.Combine(sPath, fileName)));
catch (Exception ex)
Console.WriteLine("Error" + ex.Message );
think it may help you...
Posted Date: March 10, 2012 Points: 20
hi sir attach your C# file split and merging code
Posted Date: March 12, 2012 Points: 20
Posted Date: July 20, 2012 Points: 20
This is for merging two tiff images
public void meregTiff(string files)
// creation of the document with a certain size and certain margins
iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);
// creation of the different writers
iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(document, new System.IO.FileStream(Server.MapPath("~/PDF/result.pdf"), System.IO.FileMode.Create));
// load the tiff image and count the total pages
foreach (string image in files)
string str =image.Substring(image.LastIndexOf("\\"));
System.Drawing.Bitmap bm = new System.Drawing.Bitmap(Server.MapPath("~/TiffImages" + str));
int total = bm.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);
iTextSharp.text.pdf.PdfContentByte cb = writer.DirectContent;
for (int k = 0; k < total; ++k)
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(bm, System.Drawing.Imaging.ImageFormat.Bmp);
// scale the image to fit in the page
img.ScalePercent(72f / img.DpiX * 100);
Posted Date: June 27, 2013 Points: 20
I do this almost daily. I use an image merger driver found on the internet . Install it and it becomes a selectable merger option.Then you can merge PDFs or tiffs etc.into one in any program at all, including Adobe Acrobat . Just open the images, select merge, and choice the form you want, the task will be finished in several seconds. if you haven't found a good choice , you can have a try. best wishes.
Posted Date: March 02, 2014 Points: 20
I am using another Tiff processing tools instead of Adobe's products. Here are the tutorials about how to merge Tiff files using it:
I hope it helps. Good luck.
Next Tomorrow is Another Day
To post reply
Related Questions Related Questions
Merge files in C#.net
Accessing hidden files and write in it
How to merge or group the columns in gridview....??
ASP.NET web application - WebResource.axd and ScriptResource.axd files - Loading time issue
How to add Flash files in asp.net 3.5 application
Storing and Retrieving Files in Database
What are .mdf files?
Latest Forum Questions From The Same Category
Mail is working but I want send two excel file to each different person
how to display child nodes with headers and keeping the child nodes in a table
In DataGrid I have Two Dropdownlist, One in Header template and Item Template
Display data directly from database table to PDF using stored procedures in asp.net C#
How to install and use Dev Express ?
Dialogbox Custom Control
Custom Control in Winforms
I just started learning c#.net console application
How to read csv file which have many special character and tabs?
USSD using AT COMMAND
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more
Quick Links For Forum Categories:
Hall of Fame
Terms of Service
Tell A Friend