Skip to content

Instantly share code, notes, and snippets.

@kazuph
Created April 6, 2014 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuph/10002343 to your computer and use it in GitHub Desktop.
Save kazuph/10002343 to your computer and use it in GitHub Desktop.
写真整理用。
#!/usr/bin/env ruby
# coding : utf-8
require 'awesome_print'
require 'pry'
# このスクリプト以下のファイルを見つけたら、このディレクトリに配置する
# 重複を避けるためディレクトリの階層分の名前に変更してmvする
Dir.glob("./**/*").each do |fp|
next if FileTest.directory?(fp)
ap fp
re_name = fp.gsub(/\//, '_').sub(/^\._/, './')
FileUtils.mv(fp, re_name)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment