Thursday, 22 March 2012

How to create a blank file with a fixed size

I had the need today to create a number of blank files with a fixed size.   I thought I would share the method.

fsutil is the program needed to create a blank file.   Under Windows 7, it needs to be run as the administrator.

It's used in the following way:

fsutil file createnew <name of file> <size in bytes>

For example the following line would create a 10mb blank Word document:

fsutil file createnew C:\file.doc 10485760

Just as the following line would create a 1gb blank Excel document:

fsutil file createnew C:\file.xls 1073741824