From: "Peña, Botp" Date: 2007-07-02T11:52:38+09:00 Subject: Re: Test equality of each element in an array From: list-bounce@example.com : # if extNot2move.include?(File.extname(fn).downcase) # Does not work # # if !['.jpg', '.pdf', # '.mrw','.png','.psd','.tif','.gif','.pict'].include?(File.extn # ame(fn).downcase) # # seems to work # I need to check the logic of what I'm doing after the test. I've got # myself lost in trying out so many variations. careful w your naming. You're using extNot2move, so that would mean, "the extensions of files you would NOT want to move". The File#extname method also returns the prefix dot "." as part of the extension, so you need to adjust your extension names. try something like, ext = %w(jpg pdf mrw png pdf tif) # it's easy to add here extNot2move = ext.map{|e| "."+e} # this handles the needed "." and then your test would be any of the ff: 1) if ! extNot2move.include?(File.extname(fn).downcase) 2) if not extNot2move.include?(File.extname(fn).downcase) 3) unless extNot2move.include?(File.extname(fn).downcase) i'd prefer the 3rd style on my case, i find myself usually asking the q the other way around, like "is this element in this set?" you may try creating an #in? method something like > module Enumerable > def in?(container) > container.include?(self) > end > end or > module Enumerable > def in?(container) > container.any?{|elt| elt==self} > end > end > "jpg".in? extNot2move => false > ".jpg".in? extNot2move => true > ".jgg".in? extNot2move => false > File.extname("text.JPG").downcase.in? extNot2move => true > File.extname("text.JGG").downcase.in? extNot2move => false kind regards -botp