To do some alert testing I needed to create a very large file on windows, so I wrote a little perl script to do it.
This script works fine on my desktop with ActivePerl 5.8.8.
I put it on the servers I need to test with Perl 5.6.1 and it doesn't work at all. Can anyone suggest why?
# Script create_big_file.pl
#
# Generates a file 10gb in size. Use -s to change the size.
#
use Getopt::Std;
my $usage = <<EOT;
Usage: $0 [-h] [-f file] [-s size]
-h This help screen.
-f file The file to create.
-s size Size of the file to create in GB.
Example: create_big_file.bat -s 26 -f 26gb.dat
EOT
warn($usage), exit(0) if !getopts('hf:s:',\%OPT) or $OPT{'h'};
$filesize = 10000000000;
if ($OPT{'s'}) {
$filesize = $OPT{'s'} * 1000000000 ;
}
$filename = "oat_bigfile_1.dat";
if ( $OPT{'f'}) {
$filename = $OPT{'f'};
}
$size = $filesize -1;
print STDOUT "Creating $filename of $filesize bytes.\n";
open(BIGFILE, "+>", "$filename") || die ("Could not create $filename.\
+n");
binmode BIGFILE;
die("Could not extend $filename to $filesize bytes.\n") unless seek BI
+GFILE, $size, 0;
print BIGFILE "\0";
seek BIGFILE, 0, 0;
close BIGFILE;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.