K
Kaldrenon
Hi all.
A while ago I installed Vista on one of my hard drives (I'm running XP
Home on the other) but quickly decided that I wasn't going to make the
switch. Now I want to get rid of the Vista system files, but since
there are things on the drive that I want to keep (more than I can
easily transfer to a different hard drive), what I'm trying to do is
to write a Perl script that uses File::Find to wipe the directories
that contain system files, leaving the remaining dirs untouched. I
wrote something that worked, or so I thought, but then I realized that
it left a large number of system files and the like in place. They're
the files which say "Access Denied" if I try to del them from cmd.exe
or Windows Explorer.
Is there an easy way to override file permissions in Perl? chmod or
something like it?
Here's what I already have (it's small enough to be its own SSCCE):
use File::Find;
$| = 1;
$\ = "\n";
@folders = ("F:/Windows","F:/Program Files","F:/Program Data","F:/
Users");
find(\&break_it, @folders);
sub break_it
{
unlink($_) if -f;
rmdir($_) if -d;
print $_, " deleted.";
}
P.S. I realize that this would be a horrendously unsafe idea if I
weren't convinced that I don't want these files any more.
Thanks,
Andrew
A while ago I installed Vista on one of my hard drives (I'm running XP
Home on the other) but quickly decided that I wasn't going to make the
switch. Now I want to get rid of the Vista system files, but since
there are things on the drive that I want to keep (more than I can
easily transfer to a different hard drive), what I'm trying to do is
to write a Perl script that uses File::Find to wipe the directories
that contain system files, leaving the remaining dirs untouched. I
wrote something that worked, or so I thought, but then I realized that
it left a large number of system files and the like in place. They're
the files which say "Access Denied" if I try to del them from cmd.exe
or Windows Explorer.
Is there an easy way to override file permissions in Perl? chmod or
something like it?
Here's what I already have (it's small enough to be its own SSCCE):
use File::Find;
$| = 1;
$\ = "\n";
@folders = ("F:/Windows","F:/Program Files","F:/Program Data","F:/
Users");
find(\&break_it, @folders);
sub break_it
{
unlink($_) if -f;
rmdir($_) if -d;
print $_, " deleted.";
}
P.S. I realize that this would be a horrendously unsafe idea if I
weren't convinced that I don't want these files any more.
Thanks,
Andrew