Skip to content

Instantly share code, notes, and snippets.

@TheAshwanik
Forked from schatteleyn/synch.rb
Created July 27, 2013 10:27
Show Gist options
  • Save TheAshwanik/6094507 to your computer and use it in GitHub Desktop.
Save TheAshwanik/6094507 to your computer and use it in GitHub Desktop.
computer = #path to movies directory
hd = #path to movies directory
def get_movies(path_comp, path_hd)
# Return ana rray with only the new movies. I exclude the directory Series in the search
return `ls #{path_comp} | grep -v Series`.split(/\n/) - `ls #{path_hd} | grep -v Series`.split(/\n/)
end
new_movies_list = get_movies(computer, hd)
new_movies_list.each do |movie|
`cp -R #{computer}/"#{movie}" #{hd}`
puts "cp #{movie} to hard drive"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment