如何有效地多次比较 15000 个文件?

发布于 2024-07-12 22:35:05 字数 173 浏览 7 评论 0原文

我正在比较两个几乎相同的文件夹,其中包括应忽略的隐藏 .svn 文件夹,并且我想不断快速比较这些文件夹,因为某些文件已修补以比较差异,而无需再次检查未更改的匹配文件。

编辑: 因为有很多选择,所以我对一个能够清楚地利用先前比较中的知识的解决方案感兴趣,因为在进行重复比较时任何其他解决方案都不是真正可行的。

I am comparing two almost identical folders which include hidden .svn folders which should be ignored and I want to continually quickly compare the folders as some files are patched to compared the difference without checking the unchanged matching files again.

edit:
Because there are so many options I'm interested in a solution that clearly exploits the knowledge from the previous compare because any other solution is not really feasable when doing repeated comparisons.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

岁月静好 2024-07-19 22:35:05

如果您愿意花一点钱,Beyond Compare 是一个非常强大的比较工具,可以进行基于文件夹的比较。

超越比较

If you are willing to spend a bit of money, Beyond Compare is a pretty powerful diffing tool that can do folder based diffing.

Beyond Compare

梦年海沫深 2024-07-19 22:35:05

我个人使用 WinMerge 并发现它非常有用。 它有排除 svn 文件的过滤器。 在linux下我更喜欢Meld

I personally use WinMerge and find it very useful. It has filters that exclude svn file. Under linux i prefer Meld.

︶葆Ⅱㄣ 2024-07-19 22:35:05

一种选择是使用 rsync。 类似于:

rsync -n -r -v -C dir_a dir_b

-n 选项会进行空运行,因此不会修改任何文件。 -r 进行递归比较。 可以选择使用 -v 打开详细模式。 (您可以使用 -i 来逐项列出更改,而不是 -v。)要忽略通常被忽略的文件,例如 .svn/,请使用 -C

当我阅读 rsync 联机帮助页时,这应该比简单的 diff 更快:

Rsync 使用“快速检查”查找需要传输的文件
查找大小已更改的文件的算法(默认情况下)
或最后修改时间。 其他保留的任何更改
属性(根据选项的要求)是在目标文件上创建的
当快速检查表明文件的数据不存在时直接
需要更新。

由于“快速检查”算法不直接查看文件内容,因此它可能会被愚弄。 在这种情况下,可能需要使用 -c 选项来执行校验和。 它可能比普通的 diff 更快。

此外,如果您计划在某个时候同步目录,这也是完成该工作的好工具。

One option would be to use rsync. Something like:

rsync -n -r -v -C dir_a dir_b

The -n option does a dry-run so no files will be modified. -r does a recursive comparison. Optionally turn on verbose mode with -v. (You could use -i to itemize the changes instead of -v.) To ignore commonly ignored files such as .svn/ use -C.

This should be faster than a simple diff as I read the rsync manpage:

Rsync finds files that need to be transferred using a "quick check"
algorithm (by default) that looks for files that have changed in size
or in last-modified time. Any changes in the other preserved
attributes (as requested by options) are made on the destination file
directly when the quick check indicates that the file's data does not
need to be updated.

Since the "quick check" algorithm does not look at file contents directly, it might be fooled. In that case, the -c option, which performs a checksum instead, may be needed. It is likely to be faster than an ordinary diff.

In addition, if you plan on syncing the directories at some point, this is a good tool for that job as well.

淡淡的优雅 2024-07-19 22:35:05

并非万无一失,但您可以比较时间戳。

Not foolproof, but you could just compare the timestamps.

So尛奶瓶 2024-07-19 22:35:05

使用总司令! 所有优秀的开发人员都使用它:)

Use total commander ! All the cool developers use it :)

爱格式化 2024-07-19 22:35:05

如果您使用的是 Linux 或某些变体,您应该能够执行以下操作:

prompt$ diff -r dir1 dir2 --exclude=.svn

-r 强制递归查找。 有很多开关可以忽略空格等内容。

If you are on linux or some variant, you should be able to do:

prompt$ diff -r dir1 dir2 --exclude=.svn

The -r forces recursive lookups. There are a bunch of switches to ignore stuff like whitespace etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文