Skip to content

Instantly share code, notes, and snippets.

@ifukazoo
Created August 23, 2014 12:32
Show Gist options
  • Save ifukazoo/f3421b351c7b9ee80e44 to your computer and use it in GitHub Desktop.
Save ifukazoo/f3421b351c7b9ee80e44 to your computer and use it in GitHub Desktop.
フォルダのコンテキストメニューから時刻名のfolderを作る
"C:\\Program Files (x86)\\Ruby-2.1\\bin\\ruby.exe" "C:\\Installed\\timefolder.rb" "%1"
# 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