Warning:
Use this at your own risk
Backup your files before using them in the software
Backup often, test your backup.
Verify and dry test your files before doing a production run
I had to write this program
because rmdir was claiming not to have enough authorization
context
use strict;
use warnings;
use File::Path qw(remove_tree);
# Specify the directory to be deleted
my $directory = 'c:\\Users\\mydirectory\\mysubdirectory\\';
# Remove the directory
remove_tree($directory, {error => \my $err});
# Check for errors
if (@$err) {
foreach my $diag (@$err) {
my ($file, $message) = %$diag;
if ($file eq '') {
print "General error: $message\n";
} else {
print "Problem unlinking $file: $message\n";
}
}
} else {
print "Directory successfully deleted.\n";
}