Wednesday, October 12, 2011

Generating dummy file on cmd

http://www.windows-commandline.com/2009/07/how-to-create-large-dummy-file.html

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

No comments:

Post a Comment