title: Quick Ruby Batch renamer
body: <p>I am trying to tie in a few different scripts I have noticed here and here <a href="http://maravan.wordpress.com/2006/10/16/extending-the-ruby-strip-method/" rel="nofollow">link text</a>
  Trying to get a basic script that will allow me to strip characters or rename files given a directory characters and file extension by user.</p>
  
  <p>I am struggling to tie it all together. This is where I am so far.</p>
  
  <pre><code>    require 'fileutils'
  
  define renamer(strip, stripdetails) 
  # So this is a strip function.
  
      def strip(str,char)
     new_str = ""
     str.each_byte do |byte|
        new_str &lt;&lt; byte.chr unless byte.chr == char
     end
     new_str
  end
  # and then retrieve details from user.
  
  #Get directory of files to be changed.
  def stripdetails(strip myname)
   puts "Enter Directory containing files"
   STDOUT.flush
   oldname = gets.chomp
   puts "what characters do you want to remove"
   str = gets.chomp
   puts "what file extension do files end in?"
   fileXt = gets.chomp
   end
  
  #And I found this from stackoverflow(I don't have enuff credits to post another hyperlink)
  old_file = "oldname"
  new_file = strip(oldname,str)
  FileUtils.mv(old_file, new_file)
  </code></pre>