# 定义要遍历的目录路径
$rootPath = "C:\XXX\XXX\XXX\XXX\XXX\"
# 遍历目录并计算所有XML和properties文件的MD5
Get-ChildItem -Path $rootPath -Recurse |
Where-Object { $_.Name -match "(\.xml|\.properties)" } |
ForEach-Object {
$filePath = $_.FullName
$fileHash = (Get-FileHash -Path $filePath -Algorithm MD5).Hash
# 打印文件路径和MD5哈希值
"{0} : {1}" -f $filePath, $fileHash
}