比较两种环境中的文件夹结构
是否有任何好的工具可以比较两个环境之间的两个文件夹结构(包括文件)?
即比较开发计算机与生产
编辑:
关于一些经验教训的说明:dir /s /o:N >>> output.txt
与文本比较工具(我使用 WinMerge)结合使用效果很好,但文件系统似乎确实很重要。 NTFS 对 FAT32 的效果不佳,因为一个以相反的字母顺序扫描文件夹,而另一个则不然。 为了解决这个问题,我将文件从 FAT32 复制到 NTFS 驱动器。
另外,DiffMerge 很好,但速度很慢。 它实际上在服务器上运行时挂起(我可以访问两组文件),以至于我不得不强制退出。
我确信其他人也有关于使用 *NIX 执行此操作的想法。 可能是类似的技术,如 ls -alR > 输出
它仍然是相当手动的,但效果很好。
请记住,文件夹上的时间很可能会有所不同,因此您可能需要使用正则表达式来替换它们并使它们更加一致,因为这是相当良性的(我使用 [\d]{2 }/[\d]{2}/[\d]{4}[\s]*[\d]{2}\:[\d]{2}\sAM[\s]*\
和 [\d]{2}/[\d]{2}/[\d]{4}[\s]*[\d]{2}\:[\d ]{2}\sPM[\s]*\
)。
Are there any good tools for comparing two folder structures (files included) between two environments?
i.e. comparing a dev computer with production
Edit:
A note on some lessons learned: dir /s /o:N >> output.txt
works well in conjunction with a text comparison tool (I used WinMerge), but the filesystem does appear to matter. NTFS against FAT32 doesn't work well, as one scans the folders in reverse alphabetical order, and the other doesn't. To solve this issue, I copied the files from the FAT32 to an NTFS drive.
Also, DiffMerge is nice, but slow. It actually hung when run on the server (that's where I had access to both sets of files) to a point that I had to force a quit.
I'm sure others have thoughts on doing this with *NIX. Probably a similar technique like ls -alR > output
It's still pretty manual, but it works well.
Just keep in mind that the times on the folders will more than likely be different, so you may want to use a regex to replace them and make them more consistent, since that's fairly benign (I used [\d]{2}/[\d]{2}/[\d]{4}[\s]*[\d]{2}\:[\d]{2}\sAM[\s]*\<DIR\>
and [\d]{2}/[\d]{2}/[\d]{4}[\s]*[\d]{2}\:[\d]{2}\sPM[\s]*\<DIR\>
).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我使用 Diff merge (http://www.sourcegear.com/diffmerge/ - 它有一个免费的版本)用于比较 Windows 上的文件夹结构
I use Diff merge (http://www.sourcegear.com/diffmerge/ - it has a free version) for comparing folder structures on Windows
对于在 Windows 上运行的工具(但可以针对 Linux samba 共享工作),请尝试 BeyondCompare。
For a tool that runs on Windows (but can work against Linux samba shares), try BeyondCompare.
一扇窗户。
对从此 cmd 生成的文件使用您最喜欢的 diff 工具。
从您想要比较的文件夹运行此命令。
c:\somefolder>dir /s > 搜索结果.txt
One windows.
Use your favorite diff tool on the files generated from this cmd.
Run this from the folders you wish to compare.
c:\somefolder>dir /s > searchResult.txt
WinMerge 还可以进行文件夹和文件比较,而且是免费的
WinMerge also does folder and file comparison and its FREEE
选项 1)
将其中一台计算机安装到另一台计算机上,然后使用一些标准目录比较实用程序。
选项 2)
使用 rsync --dry-run 并以某种方式使用输出。
选项 3)
生成每一侧文件的哈希值(例如 sha256),然后比较列表。
Option 1)
Mount one of the machines on the other, then use some standard directory compare utility.
Option 2)
Use
rsync --dry-run
and use the output in some way.Option 3)
Generate hashes (e.g. sha256) of the files on each side, then compare the lists.
WinDiff 和 KDiff 似乎都擅长做到这一点,而不需要命令行目录列表。 我个人偏好是 KDiff。
WinDiff and KDiff both seem good at doing this without the need for command line dir listing. My personal preference is KDiff.