Powershell需要比较目录和文件的帮助

发布于 2025-02-11 05:24:31 字数 469 浏览 0 评论 0原文

我正在尝试交流文件和目录。我首先要确保所有相同的文件都在那里,然后进行某种类型的比较,而无需哈希所有文件。两个文件夹都具有相同的结构,并且应该非常相似。但是,我担心有人只修改了一个目录或文件夹。任何帮助将不胜感激。

$FirstPath = "\\Server001\c$\Files"
$SecondPath = "\\Server002\c$\Files"

$firstcomp = Get-ChildItem -Recurse –Path $FirstPath
$Secondcomp = Get-ChildItem -Recurse –Path $SecondPath

Compare-Object -ReferenceObject $firstcomp -DifferenceObject $Secondcomp

我正在比较大约10 GB的文件。

我什至不知道完成第二部分的最佳方法是什么,因为我一直收到第一部分中不存在的文件错误。

I am trying to copare files and directories. I want to first ensure that all of the same files are there, and then do some type of comparison without having to hash all of the files. Both folders have the same structures, and should be very similar. I am however afraid that someone has modified only one directory or folder. Any help is greatly appreciated.

$FirstPath = "\\Server001\c$\Files"
$SecondPath = "\\Server002\c$\Files"

$firstcomp = Get-ChildItem -Recurse –Path $FirstPath
$Secondcomp = Get-ChildItem -Recurse –Path $SecondPath

Compare-Object -ReferenceObject $firstcomp -DifferenceObject $Secondcomp

I am comparing approx 10 Gb of files.

I do not even know what is the best way to accomplish the 2nd part of this because I keep receiving errors for files that do not exist in the first part of this.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文