I want to create a huge dummy file say 1~2 GBs in matter of seconds. here is what I\'ve written in C# :
file.writeallbytes(\"filename\",new byte[a huge numbe
If you don't care about the contents, then by far the fastest way I know of is this - it is practically instant:
private void CreateDummyFile(string fileName, long length)
{
using (var fileStream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None))
{
fileStream.SetLength(length);
}
}