#!/usr/bin/perl -I../perl_modules
# $Id: createFiles,v 1.2 2001/07/25 19:18:40 jeffb Exp $

use strict;

die "You need to give a user name\n" if (! @ARGV);

my $user = $ARGV[0];
my $files = 20000;
my ($homeDir) = (getpwnam($user))[7];
die "Home directory does not exists" unless(-d $homeDir);
$homeDir = $homeDir."/web";

my $text = <<EOF;
All your base are belong to us

EOF

chdir $homeDir;
foreach (my $i = 1;$i < $files;$i++) {
	my $file = "file".$i.".html";
	unless($i % 500) {
		system("mkdir $homeDir/$i");
		chdir($homeDir."/".$i);
	}
	open(FH, "> $file") || die "could not open $file: $!\n";
	print FH $text;
	close(FH);
}
exit 0;
