Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
require 'fileutils'
dirs = Dir['path_to_your_root_music_directory/**/*.*']
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
You can’t perform that action at this time.