0

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?

ubernewb
  • 1
  • 1

1 Answers1

0

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\"

Little King
  • 1,030
  • 1
  • 8
  • 14
  • This didn't work because the path "C:\DocsRedirect\username\Application Data\" doesn't exsist. What I need to do is have this run through each users Application Data folder like this: C:\DocsRedirect%\user1%\Application Data\ C:\DocsRedirect\%user2%\Application Data\ ... Does that make sense? I'm looking for the cumulative size of all users Application Data folder. This folder is currently redirected to a file server, and the path on the file server is:"C:\DocsRedirect\\Application Data\" – ubernewb Apr 28 '15 at 22:03
  • So why not just get all child items in C:\DocsRedirect that are directories and for each of those pump that into my aforementioned foreach loop? – Little King May 01 '15 at 14:36