Last active
April 17, 2018 17:17
-
-
Save shinjijai/ff7959110ff60edd47692554eee00d80 to your computer and use it in GitHub Desktop.
Takes an array of folder locations and exports a CSV file with the file hash, name and directory name.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$FolderLocation = @("FilePath1", "FilePath2", "FilePath3") | |
$AllFiles = @() | |
$FileList = @() | |
foreach($RootFolder in $FolderLocation) { | |
$AllFiles += Get-ChildItem -Path $RootFolder -File -Recurse | |
} | |
foreach($File in $AllFiles) { | |
$FileHash = Get-FileHash $File.PSPath | Select-Object Hash -ExpandProperty Hash | |
$FileInfo = [PSCustomObject]@{ | |
Folder = $File.DirectoryName | |
FileName = $File.Name | |
"FileSize (KB)" = [math]::Round($File.Length / 1KB,2) | |
FileHash = $FileHash | |
} | |
$FileList += $FileInfo | |
} | |
$Filelist | Export-CSV -NoTypeInformation "File Information.csv" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment