Rsync: Identifying the files which have been updated

require "rsync"

Rsync.run("/tmp/trinkets", "/tmp/trinkets2" ,'-a') do |result|
  if result.success?
    result.changes.each do |change|
      puts "#{change.filename} (#{change.summary})"
    end
  else
    puts result.error
  end
end

Output:

trinkets/ (timestamp)
trinkets/today.txt (updating local)

In the above code example the trinkets directory contained 2 files to be copied to trinkets2. The only file which had changed since the previous rsync update was today.txt, which is reflected upon the output as shown.

Resources