Comparing the modified dates of files in two directories

Hi

Is it possible to compare the modified dates of all the files in two directories using shell script?

I would like to take a backup of a directory in production server regularly.

Instead of copying all the files in the directory, is it possible to list only the files that are modified recently?

i.e compare the modified date of a file in production and backup directory and copy only if the file is modified.

Thanks
Ashok

Each time you run your backup use 'touch' to create a file called backup_complete.txt, then the next time you go to backup you can use find to backup all the updated and new files.

find . -newer backup_complete.txt -exec tar rf backup_delta.tar {} \;

use rsync command to sync both folders.

check out the below page for examples

Geek Stuff - Synchronize two folders on a Mac and other Unix Systems with Rsync - Branko Jevti?'s Piece Of Web