Created
February 18, 2016 08:21
-
-
Save miyamae/95f831eab8bea4593eac to your computer and use it in GitHub Desktop.
下層ディレクトリ内のファイルをランダムに選択して開く(Mac)
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
#!/usr/bin/env ruby | |
Dir.chdir(File.expand_path('..', __FILE__)) do | |
files = Dir.glob('**/*.{mp3,wma}') | |
file = files[rand(files.size)] | |
puts file | |
system "open \"#{file}\"" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment