≡ Menu

How to create large dummy file

Fsutil.exe is a built in filesystem tool that is useful to do file system related operations from command line. We can create a file of required size using this tool.

syntax to create a file:

fsutil file createnew filename length
(length is in bytes)

For example, to create a dummy file test.txt, with size as 50MB :

fsutil file createnew test.txt 52428800

Note that the above command creates a sparse file which does not have any real data. If you want to create a file with real data then you can use the below command line script.

echo "This is just a sample line appended to create a big file.. " > dummy.txt
for /L %i in (1,1,14) do type dummy.txt >> dummy.txt

(Run the above two commands one after another or you can add them to a batch file.)

The above commands create a 1 MB file dummy.txt within few seconds.  If you want to create 1 GB file you need to change the second command as below.

echo "This is just a sample line appended to create a big file.. " > dummy.txt
for /L %i in (1,1,24) do type dummy.txt >> dummy.txt

The first command(echo…) creates the file dummy.txt with 64 bytes.
The second command, runs in a loop for 24 times, and each times doubles the size of the file, by appending it to itself.
One more example:

Create a 100MB file with real data:

echo "This is just a sample line appended  to create a big file. " > dummy.txt
for /L %i in (1,1,21) do type dummy.txt >> dummy.txt

The above command creates a 128 MB file.

50 comments… add one
  • Bruce

    That for loop is nice trick to create big files..
    did not know creating 1 GB file would be that simpler without using any additional tool. Thanks for sharing. Cheers…

  • Anonymous

    What would be the command to create file of size 2 gb?

    • brubbel

      replace 14 with 28000

    • Frank Nichols

      for /L %i in (1,1,25) do type dummy.txt >> dummy.txt

      because it doubles every time it runs.

  • Techblogger

    The command would be :

    echo "This is just a sample line appended to create a big file " > dummy.txt

    for /L %i in (1,1,25) do type dummy.txt >> dummy.txt

    If you increase the bold number by 1, you can double the size of the file. If you decrease it by 1 you will reduce the file size by half.

    • blackq

      Could you please help with the following questions:

      1. when I reduced the number of characters in the dummy.txt file, the size of the file got smaller after the “for /L … dummy.txt >> dummy.txt” loop. Would you please explain how this calculated?

      2. “If you increase the bold number by 1, you can double the size of the file”. Would you please shed some light on this calculation?

      Thank you very much!

    • admin

      1. The script initially writes the text specified in the command to the file. for(1,1,n) executes the type command n times. And each time the type command appends the file content in dummy.txt to the same file. So the size of the file doubles with each iteration. So if you decrease the number of characters in the initial file, automatically the size of the final file will also be lesser.
      2. As explained above, if you execute the for loop n times, the size of the file at the end will be pow(2,n)*number of characters in the initial text.

    • blackq

      Thank you for your explanation.

      This method worked nicely when I created small files sizes such as 1MB, 1GB, 2GB. However, when I created 128GB file, the “for” loop time continued to run and even completed. However, the file size never grow greater than 4GB. I thought it might be a Windows 2003 limitation so I used another tool to create the 128GB file. That tool successfully created the big 128GB file. Maybe this append file method has a limitation at 4GB?

      Thank you.

    • Boby

      Hi blackq ,

      I think, that FAT32 took over from FAT16 and has a maximum drive size of 2TB. Its maximum file size is 4GB, so the file more than 4 GB will not be created.

      Thank you!

  • Anonymous

    Is there a way to loop it to make a multiple large files? without manualy changing the txt file name, eg dummy1.txt dummy2.txt I'm trying to make a folder full of 4Mb files.

  • Techblogger

    You can do that. First create a file with the above commands and then create required number of files using copy command.

    Create a 4MB file:
    echo "This is just a sample line appended to create a big file " > dummy.txt

    for /L %i in (1,1,16) do type dummy.txt >> dummy.txt

    Now create more files using the above file. Let's say you want 20 files.

    for /L %i in (1,1,20) do copy dummy.txt dummy%i.txt

  • Anonymous

    Awesome! that worked thanks a ton.
    For anyone putting the command into a batch file you need to use double percentages to make it work, eg,

    for /L %%i in (1,1,20) do copy dummy.txt dummy%%i.txt

    I'm not sure why?

  • Techblogger

    Yes, we need to use '%%' in batch files. Reason looks like batch files treat %1, %2 as command line parameters passed to the batch file. So one more % is needed to differentiate local variables.

    source: http://support.microsoft.com/kb/75634

  • Thomas

    Great little article. I was just looking for a fast way to create a dummy file and FSUTIL can do that in seconds.

  • KWills

    Can any one of you tell me, in which situations you need to create dummy files…?

    • admin

      If you are developing/testing/using a software program/script that is related to files/filesystems, you may need one. For example, if you are a system administrator and are deploying a new file replication software, you may want to evaluate the software if it works for all scenarios. For this, you can create files of varying sizes and test the software before the actual deployment.

  • Brett

    This will create a highly compressible file since the same data is repeated over and over. That’s not necessarily a bad thing, but if you are testing file replication you may want to know if the compression is a factor or not in the replication performance.

    Also if you want to do performance testing, caching could skew your results if its the same bits being loaded over and over.

  • Lokesh

    Thanks, this helped me instantly create large files.

  • Anonymous
    echo "This is just a sample line appended to create a big file " > C:\dummy.txt
    for /L %%i in (1,1,25) do type C:\dummy.txt >> C:\dummy.txt
  • blackq

    Thank you very much for this post!

  • Abdul

    After wasting a day on FSUTIL but I think this is what I need. But I dont’ know what thos numbers mean. Can some explain this please step by step:

    echo “This is just a sample line appended to create a big file ” > dummy.txt

    for /L %i in (1,1,25) do type dummy.txt >> dummy.txt

    • Abdul

      I am not understanding those numbers. I would like to create files of 33MB, 34MB all the way to 50 increasing by 1 MB at a time. Can someone give me an example please. I could not follow the above example. I spent a day to create many files using FSUTIL but that’s not what I need since the data is not filled which is useless for real world testing.


    • admin

      To create a 1MB file, run this

      for /L %i in (1,1,14) do type dummy.txt >> dummy.txt

      To create 32MB file run this

      for /L %i in (1,1,19) do type dummy2.txt >> dummy2.txt

      You can use dummy.txt(1MB size) & dummy2.txt(of size 32MB) to get the files of required sizes by appending 1MB file to 32MB, 33MB.. files.

    • admin

      I have added explanation for the commands in the post.

  • Suneel Kuppili

    Its very Good Site, I have used this command to eat up 15GB space in my VM box just to test an installation of an application with less than 2 GB available space!


  • TTS

    I have a requirement to create DOCX and PDF files with varying sizes (with valid data in it), can have random text but it needs to open successfully (i.e in Word & PDF). Any generatingg tools out there that can do the job quickly?

    • TTS

      I basically need to create around 120 PDF and 120 DOCX files (1MB, 5MB, 10MB etc) and looking at the best way to do it.

    • TTS

      Also all files need to be Unique (for my testing!!)

      Any help would be much appreciated..

  • Ram

    I have a requirement to create DOCX, PPT and PDF files with varying sizes (with valid data in it), can have random text but it needs to open successfully without displaying any error message ( i.e., Document has been corrupted or not in a valid format like that ..)
    Can we’ve any command to do this. If any one suggest a tool well appreciated.
    Thanks in Advance.
    @TTS: Have you found any solution for this ?

  • Samir Gunic

    I needed a 1 GB file. I followed your instructions and now I have a file that’s “0,99 GB (1 073 741 776 bytes)”. The “size on disk” however, is indeed “1,00 GB (1 073 741 824 bytes)”. Was this intentional? When doing things like upload test or download test, what matters is the actual size of the file, not how much space is allocated for the file on the disk. The operating systems and file system on the target machine might be completely different from the source machine. So what impact does this have? None, I’d say. You’re transferring the file (size of the file) and not entire blocks of disk drive (size on disk). So this needs to be corrected for. Other than that, very clever trick! Thanks!

  • Samir Gunic

    The first command…

    echo “This is just a sample line appended to create a big file ” > C:\dummy.txt

    does not create a 64 byte file. The resulting file is only 62 byte! You can see that by counting the characters, but don’t forget to add 2 byte for CR and LF introduced by the command.

    So try with following…

    echo “This is just a sample line appended to create a big file…” > dummy.txt

    The file should now be 64 byte. So when you use the second command you will now get exactly 1 MB for the first example. The size is “1,00 MB (1 048 576 bytes)” and size on disk is “1,00 MB (1 048 576 bytes)”. And for the second example, you should now get the file size “1,00 GB (1 073 741 824 bytes)” and size on disk “1,00 GB (1 073 741 824 bytes)” as well.

    I did this on an NTFS volume with default 4096 byte clusters. Your mileage might vary.

    • admin

      Thanks for pointing that out, I corrected the command. Something went wrong looks like when I added the command in the post, I usually verify results are accurate.

  • Shan

    This is the best dummy file creator I have come across till now.

  • Jose

    Thank you for hosting/posting this page. I did not know if windows could do this.

  • Stevan

    When running fsutil file createnew if u save the extension as %random% it will duplicate itself like crazy. For example one place to save this without needing admin rights is the public pictures folder. Here’s just a line of my code

    Fsutil file createnew c:\users\public\pictures\hugefile.%random% 52428800
    goto loop

    This will create many of these files quickly. Fill a hard drive in seconds.

    • Johnny

      Unfortunately the FSUTIL creates files with nothing in them (seems like FSUTIL just marks the drive space as used with a content length of zero), so it isn’t of much use when we want to test the compression options of a backup system.

  • Johnny

    FYI. Thanks for the script. However, the script can only create files upto 4GB, even on an NTFS partition. Tried this on Windows 7, Windows Server 2008 and 2012R2. The problem seems to be the script. I am able to put 8GB ISO files in the same folder that I want to run this script. I have a feeling the “type” and pipe command doesn’t let you grow a file past 4GB.

  • Shekhar Bandaru

    Thanks a lot. This page is really informative.
    However, my requirement is:
    I have a data file with 3 lines of binary data.
    I want to increase the file size with different sizes for some specific testing.
    When I used your command, it is duplicating the existing data within the file 1000’s of times to reach the file size.
    Is there any other way to increase the file size without altering/duplicating the data inside?

  • sugat mankar

    Hi ,

    Thanks a lot to give this info. I created 3 GB docx, but now i want this docx as pdf How i should convert 3gb docx to pdf ?

  • fredo

    Create a 16MB file
    echo 01 > “c:\dummy.txt”
    for /L %i in (1,1,21) do type “c:\dummy.txt” >> “c:\dummy.txt”
    not work on Win XP

    if i use:
    echo 01 > “c:\dummy.txt”
    for /L %%i in (1,1,21) do type “c:\dummy.txt” >> “c:\dummy.txt”
    its working

  • prakash

    I need to create file of 5MB, 10 MB and 15MB with a specific requirement :
    With the current mentioned approach single Line entry will be repeated.
    My data is in a file e.g file1.txt have
    Line1 : test test2 test001
    Line2 : test001 test00002 test003
    Line3: Test01 test003 test006
    I want to Create a file of 5MB with same data repeated with the spaces inbetween.

    Any help would be appreciated.

  • Pls i aded a dummy text file
    how do i unzip it

  • Dhananjay Sabnis

    This article is very necessary for developers and fake file creators.. it generates big files of any size creates in less than second.

    Thanks for a beautiful article.

  • Jason

    Hi, sorry, how to generate 10 GB file?


  • Quarbani Sinhg

    Is it possible to use this tool instead of either “cipher /w” or CCleaner to ensure that deleted files (free space) on a disk is in fact overwritten?

    I know for sure that it is way faster to create a dummyfile of 500 GB than it is to wait 4 hours for cipher/CCleaner to wipe the free space.

    But what is your take on this?
    Any input is appreciated.

  • ikb

    It might be worth mentioning that the copy command has several switches that might be used in conjunction with .txt files created in this way (or in some other way…) to produce files of a larger size but with some variation in content.

    copy/? will give you some idea.

  • deep


  • Supreet

    Where do these files get saved? Can we create files with pdf or a doc extension? I need to test at places where there are type restrictions as well.


  • DSS

    May I know how to change the second command for 10MB and 200Mb?

  • Ryan

    TIP – If you are struggling to find the right value for an approximate files size you can always select something large, then CTL+C to kill the command once it’s reached the size you’d like.

    Just launch file explorer and press f5 repeatedly to know when to stop.

Leave a Comment