【调试记录】:windows查看一个文件夹下(多个子文件夹)每个子文件夹中文件的数量分别是多少

查看文件夹小所有文件的数量,包括子文件中的文件的数量

bash 复制代码
Get-ChildItem -Path "C:\path\to\your\directory" -Recurse | Measure-Object

查看一个文件夹下多个子文件每个子文件夹中文件的数量分别是多少

bash 复制代码
$targetFolder = "C:\path\to\your\directory" # 替换为你的目标文件夹路径

$subFolders = Get-ChildItem -Path $targetFolder -Directory -Recurse

foreach ($folder in $subFolders) {
    $folderPath = $folder.FullName
    $fileCount = (Get-ChildItem -Path $folderPath -File -Recurse | Measure-Object).Count
    Write-Host "Number of files in $folderPath: $fileCount"
}
相关推荐
巴拉巴拉~~5 小时前
Flutter 通用轮播图组件 BannerWidget:自动播放 + 指示器 + 全场景适配
windows·flutter·microsoft
双河子思5 小时前
Windows API 积累
windows
OliverH-yishuihan6 小时前
在 Windows 上安装 Linux
linux·运维·windows
淼淼7637 小时前
工厂方法模式
开发语言·c++·windows·qt·工厂方法模式
ForteScarlet7 小时前
如何解决 Kotlin/Native 在 Windows 下 main 函数的 args 乱码?
开发语言·windows·kotlin
WTCLLB9 小时前
Windows命令和工具名称
windows
YCOSA20259 小时前
雨晨 Windows 11 企业版 26H1 轻装版 28020.1362
windows
陈陈爱java9 小时前
Conda 常用命令行
linux·windows·conda
狮智先生9 小时前
【编程实践】Windows + PySide6 + Matplotlib 绘图时 WinError 32 的完整排查与解决方案
windows·ui·个人开发·matplotlib·交通物流
czhc114007566310 小时前
c# 1216
windows·microsoft·c#