Reputation: 1
We are having issue with folder redirection and want to split this up among two servers instead of one. One of the folders we are redirecting is the Application Data folder. We want to enumerate this folder for each user so we can decide how big the new shared volume should be. Is there a way to do this in power shell?
Upvotes: 0
Views: 373
Reputation: 1120
Recursive loops my friend. Perhaps someone has a better idea, but this was my approach. The output is also fun to watch :)
EDIT: $total is in BYTES. Be sure to do the conversion to what you need.
$total = 0
function Get-Childrens{
param($fullName)
Get-ChildItem $fullName | foreach{
if((Get-Item $_.FullName).VersionInfo.FileName){
Write-Host $_.FullName
$total += (Get-Item $_.FullName).Length
}else{
Write-Host $_.FullName -ForegroundColor Green
Get-Childrens $_.FullName
}
}
}
Get-Childrens "C:\Users\username\AppData\"
Upvotes: 0