Configuration Testing

Quick Post – Create a file of any size quickly

Today I had to prepare some labs for a workshop and there I needed some test files of different sizes. It is sometimes a time consuming process of getting the entire preparation done. But if you know how to create stuff quickly on the command prompt without copying and downloading you are going to be a hero.

Because this quick post can help you e.g. for testing certain disk rules if you need to shrink disk space at a fingertip or any other rule/monitor which  targets certain files.

The utility is fsutil and it is pretty old but still a great helper in many situations.

To create 5 MB file called 5MBTestFile.txt type the following command:

fsutil file createnew c:\5MBTestFile.txt 5000000

The number you need to provide is in bytes and therefore 5000000 bytes are approx. 5MB.  If you need to create an exact 5MB file you would need to use the number 5242880 (5MB * 1024 kbytes * 1024 bytes = 5242880 bytes).

Now you can choose to create any size of any file. I hope this helps!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.