Created
February 22, 2013 00:20
-
-
Save chikoski/5009728 to your computer and use it in GitHub Desktop.
ディレクトリ内のファイルから、次のファイルの名前にする数字をみつけるスニペット。
連番を振るときに便利。
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
Dir::entries(DATA_DIR).map{|i| | |
File.basename(i).gsub(/^([^\.]+).*/, "\\1").to_i | |
}.sort.last + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment