Creating a Huge Dummy File in a Matter of Seconds in C#

Simply create the file, seek to a suitably large offset, and write a single byte:

FileStream fs = new FileStream(@"c:\tmp\huge_dummy_file", FileMode.CreateNew);
fs.Seek(2048L * 1024 * 1024, SeekOrigin.Begin);
fs.WriteByte(0);
fs.Close();

This will yield a 2GB file with basically unpredictable contents, which should be fine for your purposes.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)