title: How to use perl rmtree tree to remove a directory if it contains a certain file?
body: <p>i am trying to remove all directory's on a given a path, if they contain a certain file.</p>
  
  <pre><code>#!/usr/bin/perl
  
  use strict;
  use File::Find;
  use File::Path qw( rmtree );
  
  find(\&amp;rm_errors, $_) for @ARGV;
  
  sub rm_errors{
       if ($_ eq "git_errors.txt"){
       my $path = $File::Find::dir;
       rmtree( $path );
       } 
   } 
  </code></pre>
  
  <p>Finding the directory's that contain the files is working but, rmtree is not deleting the directory. Can anyone tell me why?</p>