2017-05-19 02:42
浏览 228


Media archiving. Windows. PowerShell. (or by php in command line?)

Any way I can include the md5 hash value for each file? This script provides file size, last modified time, path\filename; having an md5 value would be useful. (Capability to handle entire disks, 100K+ files/many TBs, 4K video [large] files, etc. with ease (i.e., a clean and robust function].)

The results needs to be written into a .txt file and placed into the current working dir.

Get-ChildItem -Recurse | select Length,LastWriteTime,FullName | Format-Table -Wrap -AutoSize | Out-File filelist.txt
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dragon202076
    dragon202076 2017-05-19 03:07

    If you're using PowerShell v5 (maybe 4?), you can use get-filehash to compute the hash of each file. Then use that in a computed property in select-object.

    Get-childitem -recurse -file | select-object length,lastwritetime,fullname,@{n="Hash";e={get-filehash -algorithm MD5 -path $_.FullName | Select-object -expandproperty Hash}}
    点赞 评论