unruly
05-30-2002, 10:24 AM
#!C:/WINDOWS/PERL.EXE -w
# by Unruly, h4x0r extrodinare!
opendir(UNCONVERTED, "c:\\My Documents\\unconverted") || die "Error: $!";
foreach(readdir UNCONVERTED) {
next if !/\.txt$/i;
open(FILE, "c:\\My Documents\\unconverted\\" . $_) || die "Error: $!";
@file=<FILE>;
foreach(@file) {
$_ = "
" . $_ . "</P>\n";
}
open(OUTFILE, ">c:\\My Documents\\converted\\" . $_) || die "Error: $!";
print OUTFILE @file;
close(OUTFILE);
print $_ . " ... done\n";
}
closedir(UNCONVERTED);
print "fin\n";
adds P tags around newlines (which should technically be paragraphs of some sort.) you can easily modify it for unix use too.
# by Unruly, h4x0r extrodinare!
opendir(UNCONVERTED, "c:\\My Documents\\unconverted") || die "Error: $!";
foreach(readdir UNCONVERTED) {
next if !/\.txt$/i;
open(FILE, "c:\\My Documents\\unconverted\\" . $_) || die "Error: $!";
@file=<FILE>;
foreach(@file) {
$_ = "
" . $_ . "</P>\n";
}
open(OUTFILE, ">c:\\My Documents\\converted\\" . $_) || die "Error: $!";
print OUTFILE @file;
close(OUTFILE);
print $_ . " ... done\n";
}
closedir(UNCONVERTED);
print "fin\n";
adds P tags around newlines (which should technically be paragraphs of some sort.) you can easily modify it for unix use too.