From: Jan Date: 2009-07-05T12:47:20+09:00 Subject: Re: Using Dir.glob to grab only Directories --v9Ux+11Zm5mwPlX6 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable This is cool - is there a way to grab only non-directories (or regular files) ? Thanks, Jan * Intransition [2009-07-04 11:48:16 +0900]: >=20 >=20 > On Jul 3, 2:09=A0pm, Mario Gr wrote: > > Hi, > > > > I was wondering if there were a way to use Dir.glob to grab only > > directories. =A0After searching google for a bit I found ways to pull o= nly > > file listings, but couldn't find one for just directories. > > > > Currently, I'm using FileTest.directory?(dir) before running any > > operations to test for a directory. >=20 > Trailing '/': >=20 > Dir.glob('*/').select { |fn| File.directory?(fn) } > Dir.glob('**/*/').select { |fn| File.directory?(fn) } >=20 --=20 jan=3Dcallcc{|jan|jan};jan.call(jan) --v9Ux+11Zm5mwPlX6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iQEcBAEBAgAGBQJKUCKhAAoJEBcDvo3O83d6AGAH/2BflzKvoEO5uk2VmQXFrMJ3 tvs7EJ3mqPXQ7zPwUws+VCoPDW4cYP3LRo+kcWNNwJPLZo1PqUya152ewJ29u7mJ Uf3RV5uac9aLgcAX6tN7nEkFFDiCGHvYjjwmJI7aGtrchOkFHrENMuC+ySsOkPPy dpGAoEnzm8eFrOLlW6/myaAvsGmLgQxqeLUCQD/jKOI1nXhNMOJ00EoXa3h86ywp p1i7Y9vILA3jnBKOHVBkg1EOXe1f598eO2EvV5MsY+7r+qQnIDwy0WT10AL87xmW akX/VzxM5+RBI/reESJZaAAA7P3ysxhIvX8UbEatVsdoTvLvxWPyLJ078IyyNcw= =gGWN -----END PGP SIGNATURE----- --v9Ux+11Zm5mwPlX6--