Created
August 23, 2014 12:32
-
-
Save ifukazoo/f3421b351c7b9ee80e44 to your computer and use it in GitHub Desktop.
フォルダのコンテキストメニューから時刻名のfolderを作る
This file contains 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
"C:\\Program Files (x86)\\Ruby-2.1\\bin\\ruby.exe" "C:\\Installed\\timefolder.rb" "%1" |
This file contains 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
# encoding: windows-31J | |
require 'date' | |
require 'fileutils' | |
#timefolder.batから %1 としてフォルダの親パスを受け取る | |
parent_path = ARGV.shift | |
now = DateTime.now | |
# 親パスへ移動 | |
FileUtils.cd(parent_path) | |
#フォルダ作成 | |
new_folder_name = now.strftime('%Y%m%d_%H%M%S') + '_xxx' | |
FileUtils.mkdir new_folder_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment