Last active
October 5, 2016 07:36
-
-
Save itn3000/715bc152688c17003611ec15ba527321 to your computer and use it in GitHub Desktop.
get fileinfo in the current directory recursively using powershell
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
param([string]$location=$(Get-Location).Path) | |
$parentDir = Split-Path $location -Parent | |
ls -recurse $location ` | |
|where-object {$_.DirectoryName -ne "" -and $_.DirectoryName -ne $null} ` | |
|foreach-object{new-object PSObject -prop @{DirectoryName=[regex]::Replace($_.DirectoryName,"$($parentDir.Replace("\","\\"))[\\]*","");FileName=$_.Name;Version=$_.VersionInfo.ProductVersion;FileLength=$_.Length;LastUpdate=$_.LastWriteTime}} ` | |
|select-object DirectoryName,FileName,FileLength,Version,LastUpdate ` | |
|ConvertTo-Csv -notypeinformation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment