Create file with specified size

Yesterday I run into very strange problem with one of my friends - Echo. stopped working.

 In batch scripts, you use Echo to output something to screen - and of course you can redirect it to file.

By using Echo. (mind the dot), you specify that you want to output empty line. So if you want to create empty file from batch, you can use Echo. > c:\Temp\Empty.txt

Yesterday one script stopped working - Echo. was not working. It was working for everything else (including log files etc), just not for creating files in one folder. I have absolutely NO IDEA how that was possible (and if someone does, share any ideas, I am very curious about this one).

I remembered of less known feature from FSUtil - FSUtil can create for you empty file with predefined size. And it worked:

FSUtil File CreateNew C:\Temp\Empty.txt 0

In my case I used it only as alternative method because Echo. failed, however it can be useful if you want to benchmark performance or do something similar.

For example if I want to create 10 files with 10GB size, I would run following command:

for /l %i IN (1,1,5) Do FSutil File CreateNew C:\Temp\PerfTest\Test%i 1073741824

This would create 5 files with 10GB size. What I like about it that all files are created within miliseconds.

Published Monday, June 16, 2008 8:46 AM by martin
Filed under: ,

Comments

# » Create file with specified size A C One: What The World Is Saying About A C One

Pingback from  » Create file with specified size A C One: What The World Is Saying About A C One

Leave a Comment

(required) 
(required) 
(optional)
(required)