I'm trying to write a little script to rename my mp3s I started with this:

mp3DirName = ARGV[0]

mp3Dir = Dir.new(mp3DirName)

$fileNames = mp3Dir.entries

#this filters out things that aren't .mp3s

$fileNames.each { |x| if !(x =~ /.*mp3$/)
				

			$fileNames.delete(x)
			
		     end
		
}#end each block

$fileNames.each { | fileName | print fileName + "\n" }

which should print the names of mp3s found the the directory given at 
the command line. As near as I can tell the regex test is working right, 
but $fileNames.delete(x) doesn't seem to be doing anything. I can do 
$fileNames.delete("."); and that removes the entry "." from the list. I 
haven't a clue why this doesn't just work, but I'm guessing/hoping it's 
some idiosyncracy of ruby that I just don't know about. Thanks again guys :)

Jeremy Gregorio
gunvalk / cox.net