Skip to content

Instantly share code, notes, and snippets.

@vrybas
Created January 12, 2009 17:07
Show Gist options
  • Save vrybas/46059 to your computer and use it in GitHub Desktop.
Save vrybas/46059 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
if ((ARGV[0] == nil) || (ARGV[0] == '--help'))
puts "Usage: rmultirename [PATTERN] [REPLACEMENT]"
printf "Example: rmultirename htm html \n\n"
exit
end
STDOUT.sync = true
IO.popen(%&ls ./&) do |f|
@massive = Array.new
until f.eof?
@massive.push f.gets
end
end
@massive.each {|elm| system "mv #{elm.chomp} #{elm.gsub(ARGV[0],ARGV[1])}" if elm.include? ARGV[0] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment