比较 2 个目录中的文件时间戳
我有代码的镜像站点 @ 2 个位置:
测试和测试actions
它们只是其中包含 C# 项目的文件夹。我想确保测试始终具有最新的文件,即如果操作具有比测试更新的文件版本,则将过时的文件输出到列表中。
具体示例:
测试有2个文件: 文件1 & file2
操作有2个文件:file2 & file3
操作具有比测试更新的 file2,因此将“file2”输出到新的文本文件。
我怎样才能在 Unix 中做到这一点?
谢谢
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 than testing, so output "file2" to a new text file.
How can I do this in Unix?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你的Unix系统有
rsync
,你可以结合我认为--dry-run
和--testing
选项可以告诉您您想知道的内容。(注意:对于您的示例,这也会显示
file3
,因为它存在于操作中,但不存在于测试中......)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.(Note: For your example, this would also show
file3
, since it exists in operations but not testing...)