I have two directories with files with the same name.Basically I want to replace dir1/file.txt with dir2/file.txt if the creation date of dir1/file.txt is more recent. But i think I'm missing something in the if condition.#!/bin/bashfor i in /dir1/*; do        nameFIRR=$(basename $i)        dateINPUT=$(date -r $i)        dateOUTPUT=$(date -r /dir2/$nameFIRR)        if [ $dateINPUT -ge $dateOUTPUT ];        then         cp -u $i /dir2/$nameFIRR        fidone
Compare file dates from two directories
date;file comparison