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/ct
p_included
_in_log/SI
NGLE_CTP_5
1527_20080
725_cronus
_1396866/D
UMP_CTP_OB
JECTS_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