請問是否能利用powershell倒出 "按照檔案數量多寡倒序資料夾" 資料
像是 :
C:
    A
        1.txt
        2.txt
        3.txt
    B
        F
            4.txt
            5.txt
            6.txt
            7.txt
    C
        9.txt
        10.txt
        11.txt
        12.txt
        13.txt
        G
            7.txt
            8.txt
得出 :
folder_name , folder_file_count
C           , 5
F           , 4
A           , 3
G           , 2
B           , 0
前面是說明,
最後一行是 powershell 指令,
範例: 列出 D:\Log 中所有資料夾路徑及檔案數量.
說明:
#列出所有資料夾 Get-ChildItem D:\Log -Recurse -Directory
#列出資料夾路徑及數量 Foreach-object { [pscustomobject]@{Folder=$.FullName ;Count=@(Get-ChildItem -Path $.FullName -File).Count
#倒序排列:依數量 sort -property Count -Descending
( Get-ChildItem D:\Log -Recurse -Directory  | Foreach-object { [pscustomobject]@{Folder=$_.FullName ;Count=@(Get-ChildItem -Path $_.FullName -File).Count |} } ) | sort -property Count -Descending