本帖最后由 newswan 于 2024-7-23 18:44 编辑
powershell- $folder = "D:\share\tech"
- $outfile = "D:\out.csv"
-
- $folder = Get-Item -Path $folder
- $folderParent = $folder.Parent
- $n = $folder.FullName.Length + 1
-
- Push-Location $folder
- $List = [System.Collections.ArrayList]@()
-
- Get-ChildItem -Path "*.jpg" -Recurse -Depth 5 | Group-Object Directoryname | ForEach-Object {
- $arr = ( $_.Name.Substring($n) -split "\\" )
- $str1 = ( $arr -join "," ) + ( "," * (5 - $arr.count) )
- $str2 = $_.Count
- $str3 = $_.Group.Name -join ";"
- [void]$List.add( $str1 + "," + $str2 + "," + $str3 )
- }
-
- Pop-Location
-
- $List | Out-File -FilePath $outfile -Encoding utf8
复制代码
|