Merge Files in

Posted by Naraayanan under C# category on | Points: 40 | Views : 2246
These functions are merged a files in the Folder from One location to another location.
public  void mergefiles(string inputFile, string outputFileName)
#region get PCL file from inputFile
string[] tmpfiles = Directory.GetFiles(inputFile, "*.pcl");
#endregion get PCL file from inputFile
FileStream output = new FileStream(outputFileName, FileMode.Create);
#region start Processing
foreach (string tempInput in tmpfiles)
FileStream inputfiles = new FileStream(tempInput, FileMode.Open);
CopyStream(output, inputfiles);
#endregion start Processing



void CopyStream(Stream destination, Stream source)
int count;
byte[] buffer = new byte[BUFFER_SIZE];

while ((count = source.Read(buffer, 0, buffer.Length)) > 0)
destination.Write(buffer, 0, count);

Comments or Responses

Login to post response