Home arrow Tools arrow How to Create File for a Desired File Size

How to Create File for a Desired File Size

Posted Wednesday, 09 April 2008 by Michael Khanin
Digg!
Time to time I get the need to have some temp files of varying sizes. In Linux environment it's not a problem to do. And, in Windows environment it's not a problem anymore :).
I've used a "dd for windows". "dd for windows" could be downloded from official web site. I've created a very simple script, mkef.bat. Here is a syntax for using mkef.bat:

mkef.bat <filename> <size>


And now the content of mkef.bat:

@echo off
if {%1}=={} @Echo Please use the following syntax: mkef.bat filename size &goto :EOF
if {%2}=={} @Echo Please use the following syntax: mkef.bat filename size &goto :EOF
dd if=/dev/zero of=%1 bs=1024 count=%2




Reddit!Del.icio.us!Google!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites! title=
 

Add comment

You have no rights to add a new comment. May be you need to register on the site.