Skip to content

Instantly share code, notes, and snippets.

@mrnugget
Created December 7, 2011 14:54
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 mrnugget/1443098 to your computer and use it in GitHub Desktop.
Save mrnugget/1443098 to your computer and use it in GitHub Desktop.
No return
ruby-1.9.2-p290 :021 > def f_in_d(dir)
ruby-1.9.2-p290 :022?> d = Dir.new(dir)
ruby-1.9.2-p290 :023?> audio_files = Array.new
ruby-1.9.2-p290 :024?> d.entries.each do |f|
ruby-1.9.2-p290 :025 > if File.directory?(f) && f != "." && f != ".."
ruby-1.9.2-p290 :026?> audio_files.push(Dir.glob("#{dir}/#{f}/*.{mp3,flac,wav}"))
ruby-1.9.2-p290 :027?> end
ruby-1.9.2-p290 :028?> end
ruby-1.9.2-p290 :029?> return audio_files
ruby-1.9.2-p290 :030?> end
=> nil
ruby-1.9.2-p290 :031 > f_in_d("/media/james/howling_vibes/aufnahmen/")
=> []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment