列出当前目录的只读文件
dir|where-object{$_.IsReadOnly}
列出目录是这样:
dir|where-object{$_.PSIsContainer}
如果想知道目录下有多少文件
get-childitem|where-object{$_.PSIsContainer}|foreach-object{$_.name+": " + $_.getfiles().length}
get-childitem|where-object{$_.PSIsContainer}|foreach-object{$_.fullname+": " + $_.getfiles().length}
ls|?{$_.PSIsContainer}|%{$_.fullname+": " + $_.getfiles().length}
计算所有子目录的文件数
ls|?{$_.PSIsContainer}|%{$count=0}{$count+=$_.getFiles().length}{"Total Files:" + $count}
本文介绍使用 PowerShell 进行目录与文件管理的方法,包括如何列出只读文件、统计目录下的文件数量以及计算所有子目录的总文件数等实用命令。
2776

被折叠的 条评论
为什么被折叠?



