You can compare file modification times with test, using -nt (newer than) and -ot (older than) operators:
if [ "$file1" -ot "$file2" ]; then
cp -f "$file2" "$file1"
fi
You can compare file modification times with test, using -nt (newer than) and -ot (older than) operators:
if [ "$file1" -ot "$file2" ]; then
cp -f "$file2" "$file1"
fi