Chas Conquest wrote:
> Could you please point out how I can make this code more
> compact/cleaner/smarter???

I'll try:

ar = ["a.txt", "b.txt", "c.txt", "d.txt", "e.txt"]
br = ["first.txt", "second.txt", "third.txt", "fourth.txt", "fifth.txt"]

class FileNameSwap
# I don't know why you chose to make a class for this, but since you did I'll
# at least store the arrays as instance variables
  
  def initialize(letters,ordinals)
    @letters=letters  
    @ordinals=ordinals
  end

  def switch
    @letters.zip(@ordinals).each do |letter, ordinal|
      if File.file? letter
        File.rename(letter, ordinal)
      else
        File.rename(ordinal, letter)
      end
    end
  end
end

switcher = FileNameSwap.new(ar,br)
switcher.switch


HTH,
Sebastian Hungerecker
-- 
NP: Sentenced - Blood & Tears
Ist so, weil ist so
Bleibt so, weil war so