Anda di halaman 1dari 3

Quickly create large file on a windows system?

up vote
145
down vote
favorite
44
In the same vein as http://stackoverflow.com/questions/257844/quickly-create-a-l
arge-file-on-a-linux-system I'd like to quickly create a large file on a windows
system. By large I'm thinking 5GB. The content doesn't matter. A built in comma
nd or short batch file would be preferable, but I'll accept an application if th
ere are no other easy ways.
windows batch-file
shareimprove this question
asked Jun 11 '09 at 18:01
Leigh Riffel
3,12121538
add a comment
14 Answers
active
oldest
votes
up vote
241
down vote
accepted
fsutil file createnew <filename> <length>
where <length> is in bytes.
shareimprove this answer
edited Feb 5 '12 at 21:13
Mateen Ulhaq
5,88273161
answered Jun 12 '09 at 10:37
Patrick Cuff
16.9k74779
49
Beware that this only generates so called sparse file - you get a record in a fo
lder with a file size but not actual data clusters assigned with the file. So fo
r purposes like testing, zeroing or blocking off large blocks of data clusters i
t's useless.
ZXX Dec 21 '10 at 20:08
5
@ZXX +1 For my purposes I merely needed the file system to see the space as unav
ailable, but your information is helpful if someone else needs this.
Leigh Riffe
l Dec 22 '10 at 13:50
8
fsutil file createnew does not create a sparse file.
7:58

Per Mildner Jun 30 '13 at 1

2
It also works perfectly for upload tests.
2

Nicolas Raoul Sep 17 '13 at 8:35

"fsutil sparse setflag temp.txt" sets the sparse flag, making it a sparse file.
"fsutil sparse setrange temp.txt 0 1024" sets the range of sparseness :) Coldbla
ckice May 10 '14 at 21:53
add a comment
up vote
21
down vote
You can use the Sysinternals Contig tool. It has a -n switch which creates a new
file of a given size. It will create a file almost instantaneous.
shareimprove this answer
answered Jun 11 '09 at 19:12
Joey
188k37405494

Wow! Very fast to download and to run. The line I used is m:\contig -n M:\SpaceB
uffer.tmp 5368709120 Leigh Riffel Jun 11 '09 at 19:52
6
Just want to check if this is a sparse file or does the file actually have data
in it? slolife Jun 2 '11 at 17:35
2
It's not a sparse file (as far as I know) and the file is empty.
at 10:39
add a comment
up vote
16
down vote

Joey Jan 4 '12

I was searching for a way to generate large files with data..not just sparse fil
e..came across the below technique.
http://www.windows-commandline.com/how-to-create-large-dummy-file/
shareimprove this answer
edited May 11 '15 at 22:56
answered May 18 '11 at 8:46
Giri
26828

The link points to fsutil file createnew filename length


at 10:59
4

Thomas Ahle Apr 16 '14

Extract from the link above: If you want to create a file with real data then yo
u can use the below command line script. echo "This is just a sample line append

ed 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 t
o a batch file.) The above comm

Anda mungkin juga menyukai