--UrGtnQA9R6QcIU0f
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Jeremy Gregorio (gunvalk / cox.net) wrote:

> I'm trying to write a little script to rename my mp3s I started with this:
>=20
> mp3DirName =3D ARGV[0]
>=20
> mp3Dir =3D Dir.new(mp3DirName)
>=20
> $fileNames =3D mp3Dir.entries
>=20
> #this filters out things that aren't .mp3s
>=20
> $fileNames.each { |x| if !(x =3D~ /.*mp3$/)
> 			=09
>=20
> 			$fileNames.delete(x)
> 		=09
> 		     end
> 	=09
> }#end each block
>=20
> $fileNames.each { | fileName | print fileName + "\n" }
>=20

Dir is more powerful than that:

Dir.chdir ARGV[0]

puts Dir.glob('*.mp3').join("\n")

--=20
Eric Hodel - drbrain / segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04


--UrGtnQA9R6QcIU0f
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE9m5JdMypVHHlsnwQRAm/8AKC5iVeFF7Ko9uRR+lORjCTpugvURgCguRWj
9IhdI91iVabAyb7N+XLY1aE=
=sJhh
-----END PGP SIGNATURE-----

--UrGtnQA9R6QcIU0f--

Jeremy Gregorio (gunvalk / cox.net) wrote:

> I'm trying to write a little script to rename my mp3s I started with this:
>=20
> mp3DirName =3D ARGV[0]
>=20
> mp3Dir =3D Dir.new(mp3DirName)
>=20
> $fileNames =3D mp3Dir.entries
>=20
> #this filters out things that aren't .mp3s
>=20
> $fileNames.each { |x| if !(x =3D~ /.*mp3$/)
> 			=09
>=20
> 			$fileNames.delete(x)
> 		=09
> 		     end
> 	=09
> }#end each block
>=20
> $fileNames.each { | fileName | print fileName + "\n" }
>=20

Dir is more powerful than that:

Dir.chdir ARGV[0]

puts Dir.glob('*.mp3').join("\n")

--=20
Eric Hodel - drbrain / segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE9m5JdMypVHHlsnwQRAm/8AKC5iVeFF7Ko9uRR+lORjCTpugvURgCguRWj
9IhdI91iVabAyb7N+XLY1aE=
=sJhh
-----END PGP SIGNATURE-----