in reply to Re: Quickest way to get a list of all folders in a directory
in thread Quickest way to get a list of all folders in a directory
You also have to test that what you're getting are really dirs.
No. opendir already does that. Checking it explicitly is redundant at best, and adds a race condition at worse.
Isolate your directory path value
That's a great idea since it allows you to print it in the error message, something you failed to do. This would have been extremely useful to the OP.
$ perl -e' my ($dir_qn) = @ARGV; opendir(my $dh, $dir_qn) or die "Can'\''t open dir $dir_qn: $!\n"; ' somefile Can't open dir somefile: Not a directory
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Quickest way to get a list of all folders in a directory
by leocharre (Priest) on Aug 13, 2009 at 15:06 UTC | |
by ikegami (Patriarch) on Aug 13, 2009 at 15:13 UTC | |
by leocharre (Priest) on Aug 13, 2009 at 16:35 UTC |