本文介绍了如何监控大型驱动器/许多文件的 md5 散列进度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种最简单、侵入性最小的方法来监控大型驱动器、许多文件(8 TB、200 万)的 md5 指纹识别进度.

I am looking for the simplest and least intrusive way to monitor the progress of md5 fingerprinting of large drives, many files (8 TB, 2 million).

最好的选择是什么,例如,如果它卡住或开始无限循环,我可以看到故障文件?

What would be the best option, for example in case it gets stuck or begins an infinite loop, I can see the trouble file?

代码:

Get-childitem -recurse -file | select-object @{n="Hash";e={get-filehash -algorithm MD5 -path $_.FullName | Select-object -expandproperty Hash}},lastwritetime,length,fullname | export-csv "$((Get-Date).ToString("yyyyMMdd_HHmmss"))_filelistcsv_MD5_LWT_size_path_file.csv" -notypeinformation

啊啊啊

推荐答案

如果您想列出进度,您需要知道您的流程将在哪里结束,因此您需要在开始操作之前列出所有文件.

If you want to list progress, you need to know where your process will end, so you need to list all the files BEFORE you start operating on them.

Write-Host "Listing Files..." -Fore Yellow
$AllFiles = Get-ChildItem -Recurse -File
$CurrentFile = 0 ; $TotalFiles = $AllFiles.Count

Write-Host "Hashing Files..." -Fore Yellow
$AllHashes = foreach ($File in $AllFiles){
    Write-Progress -Activity "Hashing Files" -Status "$($CurrentFile)/$($TotalFiles) $($File.FullName)" -PercentComplete (($CurrentFile++/$TotalFiles)*100)

    [PSCustomObject]@{
        File = $File.FullName
        Hash = (Get-FileHash -LiteralPath $File.FullName -Algorithm MD5).Hash
        LastWriteTime = $File.LastWriteTime
        Size = $File.Length
    }
}

$AllHashes | Export-Csv "File.csv" -NoTypeInformation

这将为您提供一个带有进度条的漂亮标题,如下所示:

This will give you a nice header with a progress bar, which looks like this:

伊斯:

普通外壳:

这篇关于如何监控大型驱动器/许多文件的 md5 散列进度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 16:52