Created
February 11, 2019 08:55
-
-
Save tasugim/883a444917b7deb7f7ade0e949c01233 to your computer and use it in GitHub Desktop.
Octopressの記事ファイルをHugoに移行するためにリネームする。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'fileutils' | |
| pattern = /\d{4}-\d{2}-\d{2}-(.*)\.markdown/ | |
| Dir.glob('./*.markdown').each do |file| | |
| old_name = File.basename(file) | |
| next unless (md = old_name.match(pattern)) | |
| new_name = "#{md[1]}.md" | |
| FileUtils.mv(old_name, new_name) | |
| puts "rename #{old_name} to #{new_name}" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment