POWERSHELL: Get file count (with a filter) and total file size (in GB)

Search a path using a search criteria:
$files = get-childitem >folder path here< -filter >search criteria here<
$files.count
Sum the total size of the search results (in Gbs):
$totalSize = ($files | Measure-Object -Sum Length).Sum / 1GB
$totalSize

No comments:

Post a Comment