using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace split
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 2)
{
string arquivo = args[0];
string destino = args[1];
int qtd = 0;
StreamWriter writer = null;
try
{
using (StreamReader inputfile = new System.IO.StreamReader(arquivo))
{
int count = 0;
string line;
while ((line = inputfile.ReadLine()) != null)
{
//800.000 linhas
if (writer == null || count >= 800000)
{
count = 0;
if (writer != null)
{
writer.Close();
writer = null;
}
writer = new System.IO.StreamWriter(Path.GetDirectoryName(arquivo) + "\\" + Path.GetFileNameWithoutExtension(arquivo) + "_" + qtd.ToString() + ".txt", true);
qtd++;
}
writer.WriteLine(line.ToLower());
++count;
}
}
}
finally
{
if (writer != null)
writer.Close();
Console.WriteLine("Split concluido.");
}
}
else
{
Console.WriteLine("Split diretorio_e_arquivo diretorio_destino");
}
Console.WriteLine("Pressione uma tecla para continuar . . .");
Console.ReadKey();
}
}
}
