I wrote ..

>so .. your code could probably have looked something like this 
>(using the wonderful File::Path module)
>
>  #!perl -w
>  use strict;
>
>  use File::Path 'rmtree';
>
>  open DIRS, 'c:/admin/removedir.txt' or die "Bad open: $!";
>  chomp( my @dirs = <DIRS>);
>
>  rmtree( \@dirs);
>
>  __END__
>
>have fun


and I only just noticed the subject of the email .. which my code doesn't do
.. so here's a replacement

  #!perl -w
  use strict;

  use File::Path 'rmtree';

  open DIRS, 'c:/admin/removedir.txt' or die "Bad open: $!";

  chdir 'c:/admin/test';

  while(<DIRS>)
  {
    chomp;

    if( not -d ) { print qq/Directory "$_" does not exist.\n/; next }

    rmtree $_ or print qq/\n\tDirectory deletion of "$_" failed.\n\n/;
   
  }

  __END__

-- 
  jason king

  In New York, a fine of $25 can be levied for flirting. This old law
  specifically prohibits men from turning around on any city street and
  looking "at a woman in that way." A second conviction for a crime of
  this magnitude calls for the violating male to be forced to wear a
  "pair of horse-blinders" wherever and whenever he goes outside for a
  stroll. - http://dumblaws.com/

Reply via email to