use strict;
use File::Path;open (FH, 'path/to/a.html') or die "$!";
my $a_html = do {local $/; <FH>};
close FH;open (FH, 'path/to/b.html') or die "$!";
my $b_html = do {local $/; <FH>};
close FH;rmtree('c:/foo',0,0);
mkpath('c:/foo/C',0,0777);
open (FH, '> a.html') or die "$!";
print FH $a_html;
close FH;open (FH, '> b.html') or die "$!";
print FH $b_html;
close FH;
I'm not sure if the other solution worked, maybe jimijoe could say if it did or not.
$path = '';
@contents = <$path**>;
foreach $in (@contents){
$fordeletion = $in;
$x = '';
$y = '';
($x,$y) = split('\.',$fordeletion);
$pass = 1;
if($in eq "$path\/a\.html"){$pass = 0;}
if($in eq "$path\/b\.html"){$pass = 0;}
if($in eq "$path\/C"){$pass = 0;}if ($pass){
if($y eq ''){
rmdir($in);
}else{
unlink($in);
}
}
}