I have been writing a script to inventory drives by specific file types. (AVI, MPG, MP3, etc....)
I can get the base script to work using only a set drive and extension, but I would really like to have it read extensions from a file, and drives from a file.
$dir = get-childitem z:\ –recurse
ForEach ($item in $dir)
{
If ($item.extension –eq '.avi')
{
$item | select-object length,fullname,LastWriteTime | Export-CSV C:\temp\z-avi.csv –notypeinformation –append
}
}
When I search I am only finding server drivespace scripts.
Any guidance would be appreciated.
System.IO.FileInfo
object has anExtension
property. You can group objects easily withGroup-Object
.