in reply to why not glob
in thread Quickest way to get a list of all folders in a directory

For directories only you want
grep -d, glob ...
I don't use glob because it has its own syntaxt and quirks, I find this much clearer to use File::Find::Rule with regex
#!/usr/bin/perl -- use strict; use warnings; use File::Find::Rule; my $dir = '//pcnamevm/c$/program files/adobe/'; $dir = 'C:/program files/Mozilla Firefox/'; my @folders = File::Find::Rule->directory->maxdepth(1)->in($dir); use DDS; Dump \@folders; __END__ $ARRAY1 = [ 'C:/program files/Mozilla Firefox', 'C:/program files/Mozilla Firefox/chrome', 'C:/program files/Mozilla Firefox/components', 'C:/program files/Mozilla Firefox/defaults', 'C:/program files/Mozilla Firefox/dictionaries', 'C:/program files/Mozilla Firefox/extensions', 'C:/program files/Mozilla Firefox/greprefs', 'C:/program files/Mozilla Firefox/modules', 'C:/program files/Mozilla Firefox/plugins', 'C:/program files/Mozilla Firefox/res', 'C:/program files/Mozilla Firefox/searchplugins', 'C:/program files/Mozilla Firefox/uninstall' ];

Replies are listed 'Best First'.
Re^2: Quickest way to get a list of all folders in a directory (why not glob)
by toolic (Bishop) on Aug 14, 2009 at 14:48 UTC
    One difference between glob and File::Find::Rule is that the latter also returns the parent directory ('C:/program files/Mozilla Firefox', in your example). It seems the OP does not want that.
      I think that is a bug :D
        I think that is a bug :D
        Please be more specific as to what you think is a bug, and provide some evidence to support your claim.