【调试记录】: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"
}
相关推荐
大明者省37 分钟前
Label Studio安装与启动
windows
武藤一雄1 小时前
C# 异常(Exception)处理避坑指南
windows·microsoft·c#·.net·.netcore·鲁棒性
soragui2 小时前
【Python】第 4 章:Python 数据结构实现
数据结构·windows·python
橘子编程3 小时前
操作系统原理:从入门到精通全解析
java·linux·开发语言·windows·计算机网络·面试
程序员大辉5 小时前
Win11精简版的天花板:Windows X-Lite 26H1 V3完整安装教程,老电脑也能装
windows·电脑
熊明才6 小时前
PM2 服务器服务运维入门指南
运维·服务器·windows
沉迷学习 日益消瘦6 小时前
(windows环境)白嫖阿里云百炼免费 Token 使用 Claude 教程
windows·阿里云·claude·token·百炼
Mr_Xuhhh6 小时前
深入浅出ArrayList:从线性表到洗牌算法,掌握Java集合核心
windows
sunfdf7 小时前
使用免费工具在 Windows 11/10/8/7 中扩展 C 盘的 3 种方法
windows
月走乂山8 小时前
Trae CLI 全局配置 - Windows PATH 配置
windows