列出多个用户PowerShell的应用程序数据文件夹

时间:2015-04-28 16:28:31

标签: powershell multiple-users application-data

我们遇到了文件夹重定向的问题,并希望将其拆分为两个服务器而不是一个。我们重定向的文件夹之一是Application Data文件夹。我们想为每个用户枚举此文件夹,以便我们可以决定新共享卷的大小。有没有办法在power shell中做到这一点?

1 个答案:

答案 0 :(得分:0)

递归循环我的朋友。也许有人有更好的主意,但这是我的方法。输出也很有趣:)

编辑:$ total在BYTES。请确保转换为您需要的内容。

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