INFORMATICS

The Best

Przełącznik języka

This Site

CMS

Hardware

Uncategorised

useful sites

Databases

Emulators

Powershell

Storage Array

DNS

Antivirus program

Licznik

1.png8.png0.png6.png3.png5.png0.png
Today829
Yesterday1019
This week3161
This month23312
Total1806350

Visitor Info

  • IP: 34.238.190.122
  • Browser: Unknown
  • Browser Version:
  • Operating System: Unknown

Who Is Online

3
Online

Tuesday, 26 May 2020 18:49

How to create large dummy file

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

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

Explanation:
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.

Search