Compare File TimeStamps in 2 directories
I've got mirror sites of code @ 2 locations:
testing & operations
They are each just folders with C# projects in them. I want to make sure that testing always has the latest files, i.e. if operations has a more recent version of a file than testing, then output the stale file to a list.
Concrete Example:
testing has 2 files: file1 & file2
operations has 2 files: file2 & file3
operations has a newer file2开发者_如何学JAVA than testing, so output "file2" to a new text file.
How can I do this in Unix?
thanks
If your Unix system has rsync
, you can combine the --dry-run
and --testing
options to tell you what you want to know, I think.
rsync --dry-run --update -aH operations/. testing/.
(Note: For your example, this would also show file3
, since it exists in operations but not testing...)
精彩评论