From: Trick Nick Date: 2008-10-03T15:19:42+09:00 Subject: Re: Reg. Expressions with file directories Here is what i have got so far, but I need to figure out how to rename the file in that directory #!/usr/bin/ruby currentDir = Dir.new("#{ARGV[0]}") dirEntries = currentDir.entries.sort i = 0 dirEntries.each do |file| #Get pattern and test, then replace if the file contains the specified pattern #Argument sake say ARGV1 = .txt i need to rename file.txt to be file.text if file.include?("#{ARGV[1]}") print "#{file} is a txt file need to rename to .text\n" else print "This file doesnt need to be changed.\n" end print "#{dirEntries[i]} \n" i += 1 end -- Posted via http://www.ruby-forum.com/.