列出当前目录的只读文件
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}