需要帮助创建用于计算文件的powershell脚本... [英] Need help creating a powershell script for counting files...
问题描述
希望有人可以提供帮助;
hope someone can help;
我有一套文件夹;
T:\ ILIBRA \ MDDaemon \ Users \STAFF \ABB
T:\ ILIBRA \MDaemon \Users \STAFF \ACH
T:\ILIBRA\MDaemon\Users\STAFF\ABB
T:\ILIBRA\MDaemon\Users\STAFF\ACH
等等
我希望计算每个文件夹中* .msg文件的数量但不想向下搜索子文件夹:
I wish to count the number of *.msg files in each folder but don't want to search down in to sub-folders:
我可以使用
(Get-ChildItem" folder" -filter" * .msg") .Count
(Get-ChildItem "folder" -filter "*.msg").Count
但如何将我的文件夹列表传递给此命令,然后将结果输出到txt文件?
but how do I pass my list of folders to this command and then output the results to a txt file?
我被困了
:(
推荐答案
嗨Balcarras,
Hi Balcarras,
您可以通过Measure-Object cmdlet获取该信息。代码应类似于:
You can get that information through Measure-Object cmdlet. The code should be similar to:
Get-ChildItem "folder" -filter "*.msg" | Measure-Object
希望它有所帮助!!
Hope it helps!!
这篇关于需要帮助创建用于计算文件的powershell脚本...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!