I would like to create a Unix script which basically searches for files which are more than 2 days old and copy only the new files to the destination. What i mean is if the destination may have most of the files, it may not have only last 2 to 3 days file.
I am able to create the script which basically search and copy which are older than 2 days but how would i check if the destination has any of the files and how would i skip them? Also is there any other better command i can use other than "cp"?
I suppose the thing is rsync manages all this for you, it examines all the files in the source directory and any that have changed, are missing (or optionally have been removed) are synced up with the destination directory.
So no need to worry about anything changed in the last x days anymore. If you have stuff in the source you want to exclude from being copied to dest you will need to use the --exclude=PATTERN or --exclude-from=FILE options of rsync.