The method you would follow would depend on the nature of files that you are attempting to sync.
Are they flat text or are they Office documents, etc?
Some more information about the files will help us all help you.
UPDATE
At the very least, you could modify this:
$file1 = 'C:\baz1.txt';
$file2 = 'C:\bar1.txt';
if (-M $file1 < -M $file2) {
print "baz is newer than bar";
} elsif (-M $file1 > -M $file2) {
print "bar is newer than baz";
} elsif (-M $file1 == -M $file2) {
print "bar and baz are equal";
} else {
print "foo, that didn't go well!";
}
That is very rudimentary. You would want to test for the file existence, etc. But that should give you the idea.
hth.