> Thanks all!!
>
> Can someone tell me if you have any experience in generating files
> quickly(not sparse) in unix?
>
> I want to generate millions of files under some directory
>

This will generate 10000 files in less than a second. They are 0 size,
so just write something into them if you don't wont zero sized files


#!/usr/bin/perl
use strict;
my $file = "/some/where/writeable/a1";
my $j    = 0;
for ( my $i = 1 ; $i < 10000 ; $i++ ) {
    my $dts = $j++;
    open( my $FH, ">", "$file$dts" ) or die "cant open file$dts!";
    close $FH;
}



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to