Jump to content
Welcome, welcome! Come in and register, and have some developer coffee. 👨‍💻 ×

Brainstorm #1: What is the best way to create large random dummy file?


Recommended Posts

This is a discussion.

What is the best way to create large random dummy file?

Maybe as large as a few Gigabytes of single file.

Random dummy file, so that it won't be an empty file or file with null bytes.

Any idea? If possible, show some example code.

Sometimes I need to create large random dummy file for testing with my project but have no idea where to start.  I end up copying multiple files onto themselves repeatedly which is boring and inefficient.

For example:

Quote

COPY file1.ext + file2.ext + file3.ext newfile.ext

 

Link to post
Share on other sites
  • FlierMate changed the title to Brainstorm #1: What is the best way to create large random dummy file?

if on linux i would use dd

dd if=/dev/urandom of=random.bin bs=1M count=1000

will create random.bin in current dir with size 1M*1000 bytes (M=1024)

the command can be used from within WSL on WIndows 10 if it is installed.

alternatively u can write a simple one liner powershell script to do the same.

  • Love 1
Link to post
Share on other sites
1 hour ago, ChronoX said:

if on linux i would use dd

dd if=/dev/urandom of=random.bin bs=1M count=1000

will create random.bin in current dir with size 1M*1000 bytes (M=1024)

the command can be used from within WSL on WIndows 10 if it is installed.

alternatively u can write a simple one liner powershell script to do the same.

This is very neat!  I can guess: if (input file), of (output file) bs=(base size?).

I know Powershell is powerful, but I will still stick to CMD.exe.  Oh, WSL, Windows Subsystem Linux..... long heard people talking about it.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...