Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Restarting File::Find

by beech (Parson)
on Nov 24, 2015 at 23:11 UTC ( [id://1148559]=note: print w/replies, xml ) Need Help??


in reply to Restarting File::Find

#!/usr/bin/perl -- use strict; use warnings; use Path::Tiny qw/ path /; print existingParent( 'C:/WINDOWS/roshambonotexist/bl/ah/di/blah' ),"\ +n"; print existingParent( 'Q:/a/b/c/d/e/f/g/h/i/j/k/l' ),"\n"; sub existingParent { my $dir = path( shift )->absolute; while( not $dir->exists ){ $dir = $dir->parent; last if $dir->is_rootdir; } return $dir if $dir->exists; return ""; } __END__ $ perl path-tiny-parent.pl C:/WINDOWS

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1148559]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-18 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found