Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save aliang/538460 to your computer and use it in GitHub Desktop.
require 'fileutils'
dirs = Dir['path_to_your_root_music_directory/**/*.*']
begin
file = dirs[rand(dirs.size)]
end until File.file?(file)
# could check to make sure your dropbox folder is mounted/exists here
# remove all files from this dropbox folder
FileUtils.rm Dir['path_to_your_dropbox_shared_folder/*.*']
# choose one of the files, copy it to dropbox
FileUtils.cp(file, File.join('path_to_your_dropbox_shared_folder', File.basename(file)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment