Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Get information about full path, number and total space used by specific file types

$
0
0

Hello,

I'm trying to achive simple goal: to get information about:
- number of files with specific extension
- their full paths
- their total size

I've tried with:

Get-WmiObject Win32_LogicalDisk -Filter "DriveType = 3" | Select-Object DeviceID | Where-Object {$_.DeviceID -notlike "C*"} | ForEach-Object {Get-Childitem ($_.DeviceID + "\") -include *.bak -recurse}

Which gives me chance to calculate total count of those files and their total size, but I can't get full path to each object.

I would like to get at the end something like this:

D: drive contain X .bak files with total size: Y GB
D:\folder\file1.bak size GB
D:\folder\file2.bak size GB 


Viewing all articles
Browse latest Browse all 6937

Trending Articles