Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save succi0303/23e5c089f42687b055c725bd8ba9c1c9 to your computer and use it in GitHub Desktop.

Select an option

Save succi0303/23e5c089f42687b055c725bd8ba9c1c9 to your computer and use it in GitHub Desktop.
pwd配下(サブディレクトリ含む)のファイルの拡張子を`git mv`で一括変更する。txt -> md
Dir.glob("**/*.txt").each do |t|
src = File.expand_path(t)
dist = src.gsub(/txt$/, "md")
cmd = "git mv #{src} #{dist}"
puts "Execute '#{cmd}'"
`#{cmd}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment