Advertisement

07.25.2008 at 12:33AM PDT, ID: 23594783 | Points: 50
[x]
Attachment Details

Problem in using rmtree.

Asked by pinkglacier in Perl Programming Language

Hi,
I've create a function using File::Path rmtree that cleans a directory, including its contents.
However I encounter the following error:
====================================================
Can't remove directory /cmbase/INTEG_TEST/LOGS/ctp_included_in_log/SINGLE_CTP_51527_20080725_cronus_1396866/DUMP_CTP_OBJECTS_SQL: Do not specify an existing file. at nsm_ctp_included_in_single.pl line 2487
=====================================================

The following is the function I've created.
#-----------------------------------------------------------------------------------------
#  FUNCTION: cleanup
#          : Recursively delete a directory and everything in it. All directories and file will be removed including the specified directory.
#-----------------------------------------------------------------------------------------
sub cleanup
{
    my $dir = shift;
      
      rmtree( "$dir", {error => \my $err} ); //This is line 2487
      for my $diag (@$err)
      {
            my ($file, $message) = each %$diag;
            print SYSTEM_OUT "WARNING: Problem unlinking $file: $message\n";
            $warning_count++;
        }    
}Start Free Trial
[+][-]07.25.2008 at 01:45AM PDT, ID: 22086869

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628