Hello Anusha4268 and welcome to the monastery!
I guess you are using rmtree from the core module File::Path ..right?
Can you post a short example that demonstrate the behaviour you are facing? Remove all age checks and post the minimum code that reproduce your error along with the minimal file name lenght that provoke it. Remember to wrap the code in <code> .. </code> tags for readability.
Also tell us which OS are you running and what the error states: rmtree is a legacy interface to remove_tree one which provide also the possibility to specify options like verbose and safe .. Are you using them?
You receive the same error with the builtin system call ( rm -r on Linux or the Windows commands rd /S /Q )?
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
| [reply] [d/l] [select] |
I'm not able to replicate the problem, even if I use the maximal filename length available on my system.
#! /usr/bin/perl
use warnings;
use strict;
use Cwd;
use File::Path qw{ rmtree make_path };
use constant MAX_FILENAME_LENGTH => 255;
my $start_dir = getcwd();
my $depth = 200;
my $step = 'a' x MAX_FILENAME_LENGTH;
for (1 .. $depth) {
make_path($step);
chdir $step;
}
open my $fh, '>', "$step" or die $!;
chdir '..' for 1 .. $depth;
rmtree($step) or die $!;
END {
chdir $start_dir;
if (-d $step) {
rmtree($step) or warn $!;
}
}
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord
}map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
| [reply] [d/l] [select] |
It is likely that your problem is a special character (usually a space) rather than the number of characters in a directory name. In windows, the simplest solution often is to use the alternate (remember DOS 8.3 file name format) version of the name.
| [reply] |