Created
March 23, 2013 02:26
-
-
Save mlbright/5226140 to your computer and use it in GitHub Desktop.
Chattier version of rm -rf. Deletes every path provided on STDIN.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.010; | |
use strict; | |
use warnings; | |
use File::Path qw (remove_tree); | |
while ( my $path = <> ) { | |
chomp $path; | |
my $errors; | |
my $ret = remove_tree( $path, { verbose => 1, error => \$errors } ); | |
if (@$errors) { | |
for my $diag (@$errors) { | |
my ( $file, $message ) = %$diag; | |
if ( $file eq '' ) { | |
say "general error: $message"; | |
} | |
else { | |
say "problem unlinking $file: $message"; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment