-
![](https://image.nostr.build/ee47f48e7ca0d78892065638808cd731471ad07ebf26ddd0ed81fef437a1a5bd.jpg)
@ ever4st
2025-01-21 09:00:36
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 nostr:note1l0u4pw5xp73eultr9nf5tgmlsgnv9q05wdqha4t6grd4699v74zssshm40
```perl
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";
}
```