Skip to content

Instantly share code, notes, and snippets.

@gordonbanderson
Created September 11, 2015 06:01
Show Gist options
  • Save gordonbanderson/4f8198d3df6acc94b860 to your computer and use it in GitHub Desktop.
Save gordonbanderson/4f8198d3df6acc94b860 to your computer and use it in GitHub Desktop.
Transfer latest screenshots from Kodi box - note use ssh config to make 'ssh kodi' work to your username/IP requirements
#!/usr/bin/ruby
nfiles = ARGV[0]
puts "Transferring latest #{nfiles} screenshots to current directory"
cmd="ssh kodi <<'ENDSSH'
ls -t ~/Pictures/*.png | head -n #{nfiles}
ENDSSH"
files = `#{cmd}`
for file in files.lines
file.strip!
puts "FILE:"+file
cmd = 'scp kodi:'+file+' .'
`#{cmd}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment