Bill- I'm afraid I was still confusing. The last thing you gave for getting a length for a single directory works fine. I'm using that. (modified slightly). i need the depth, ie: how many directories can be stacked.
The problem that I have with the current code is that it will not clean. i get down about 20 levels and it creates a level on the server (suse 9.1) that the fsi card (red hat 7.1) or the windows client (server 2003) or the faux file system that is used (seafile) rejects. due to the rejection, there it jumps out of the loop and moves on. the next one tries (a test to see if length is the problem limiting the depth), and finds an issue, so it leaves that too. then it dies when it tries to clean it up. it says they are not empty, and it cant find the final tries. saying they don't exist. -Josh "$Bill Luebkert" <[EMAIL PROTECTED]> 11/11/2005 01:35 PM To [EMAIL PROTECTED] cc [email protected] Subject Re: Directory Depth Cleanup Try running this and see what you get - you can turn off either section by setting the if (1) { to if (0) { - mine failed at 248 and 238 : use strict; use warnings; use File::Path; my $base_dir = 'C:/fubar'; # base dir for test my $start_dir = 'C:/fubar/a1234567890'; # start here mkpath $start_dir or die "mkpath $start_dir: $! ($^E)" if not -d $start_dir; my $len; my $dir = $start_dir; if (1) { # compute longest path by trying longer dir names while (1) { $dir .= '1234567890'; $len = length $dir; if (not mkdir $dir) { warn "$dir ($len): $! ($^E)" if $debug; $dir =~ s/1234567890$//; rmdir $dir or warn "rmdir $dir: $! ($^E)"; last; } Win32::Sleep 250; # safety sleep } while (1) { $len = length $dir; if (not mkdir $dir) { warn "$dir ($len): $! ($^E)" if $debug; last; } $dir .= '1'; Win32::Sleep 250; } print "Failed on $len character path using mkdir '$dir'\n"; # Failed on 248 character path using mkdir 'C:/fubar/a1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789011111111' sleep 30; # take time to check tree here rmtree ($base_dir, 0, 0) or die "rmtree $base_dir: $! ($^E)"; } if (1) { # compute longest path by adding subdir names $start_dir = 'C:/fubar/abcdefghijk'; mkpath $start_dir or die "mkpath $start_dir: $! ($^E)" if not -d $start_dir; $dir = $start_dir; while (1) { $dir .= '/abcdefghijk'; $len = length $dir; if (not mkdir $dir) { warn "$dir ($len): $! ($^E)" if $debug; $dir =~ s/\/abcdefghijk$//; rmdir $dir or warn "rmdir $dir: $! ($^E)"; $dir .= '/a'; last; } Win32::Sleep 250; } while (1) { $len = length $dir; if (not mkdir $dir) { warn "$dir ($len): $! ($^E)" if $debug; last; } $dir .= '/a'; Win32::Sleep 250; } print "Failed on $len character path using mkdir '$dir'\n"; # Failed on 238 character path using mkdir 'C:/fubar/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/abcdefghijk/a' sleep 30; # take time to check tree here rmtree ($base_dir, 0, 0) or die "rmtree $base_dir: $! ($^E)"; } __END__ -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff) _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
