I have to write a bash shell script to achieve the following. Get the list of all files from a directory. In the destination directory, if any of these files exist compare the dates. Copy the files to the destination directly only when the source file is newer than the destination file. Has to do this for each file. I have created a for loop to achieve the copy portion. But I need help in comparing the dates of the files.
Thanks
man test
You should be able to just do a cp.