开发者

Compare File TimeStamps in 2 directories

开发者 https://www.devze.com 2023-03-18 17:50 出处:网络
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 oper

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...)

0

精彩评论

暂无评论...
验证码 换一张
取 消