FileSplitter Tool in C#

File Splitter Utility in C#

I had to come across a situation where I had to cut a large single .csv file containing 2.2 Million records into smaller files. Initially I thought of using already available split tool to do it, but then decided to write my own File Splitter tool in C#.  Thats how I came up with this tool. The File Splitter Tool takes an input file and splits it into multiple files each containing the number of records you specify. Here is the source code for the tool.

Tags: 

Why can I not open large files in Excel? What is the maximum limit to be able to open a file in Excel?

If you open a very large file in Excel it might not open up fully. For instance, I tried opening up a .csv file of 480MB and which had 2.2M records it would not open up completely. The reason is Excel has a limit of 1,048.576 rows and 16, 384 columns it can have in a file.  

Why am I not able to Move to the Begin of Stream using the Seek() Method in StreamReader?

As you use StreamReader to manipulate Text files and read one line at a time using Readline() Method you might come across a situation where you are somewhere in the middle of the Stream say on the 5th line and want to go back to the begin of the Stream. You can do that using the Seek Method on the BaseStream of the StreamReader as in this example.

Design Patterns: Scatter- Gather Pattern

 Use a Scatter-Gather that broadcasts a message to multiple recipients and re-aggregates the responses back into a single message.

 

The Scatter-Gather routes a request message to the a number of recipients. It then uses an Aggregator to collect the responses and distill them into a single response message.

 

Read More..

Pages