in reply to strange loopiness with chdir on win2k
Reverend Phil wrote:
If I have a subdirectory within a subdirectory - and they have the same name - my code seems to think that it changed into that directory, but in truth it starts from scratch in the former directory.
File::Find changes directories for you (unless you tell it not to) and is very easy to use. Here's the basic shell of how to use it.
use strict; use File::Find; my $root_dir = '/temp'; find(\&wanted, $root_dir); sub wanted { if ( -d ) { # you've been 'chdir'ed to this directory print "Directory: $_\n"; } else { # not a directory. do as you will } }
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|