[cmdletbinding()]
Param(
[Parameter(
ValueFromPipeline=$true)
][string[]]$paths,
[string]$inputfile,
[string]$outputName = "folders-files-and-size",
[string]$outputPath = "."
)
BEGIN {
Set-StrictMode -version 2
$date = Get-Date -format yyyy-MM-dd-HHmmss;
if($inputfile) {
$paths = import-csv $inputfile | select -expand path
}
}
PROCESS {
foreach($path in $paths) {
$files = Get-ChildItem -Recurse $path | Where { !($_.PSIsContainer) }
$size = ($files | select -expand Length | Measure-Object -Sum).Sum