我想从我的硬盘递归得到所有的文件和我使用enumeratefiles从system.io.directory如下PowerShell的测试:隐藏文件和系统文件
[System.IO.Directory]::EnumerateFiles("J:\","*","AllDirectories")|out-file -Encoding ascii $outputfile
foreach($line in select-string -Path $outputfile) {
# Some of the $line is the name of a hidden or system file
}
但是这工作正常,许多行包含隐藏或系统文件。
我已经使用ennumeratefiles作为j:驱动器非常大,并且此功能的运行速度快于等效的powershell cmdlet。
我该如何测试这些文件类型?
有关于如何exlude从enumeratefiles对于C这些文件类型的东西+ +,但也不是为PowerShell和我不知道如何更改PowerShell中的代码:
c++ file hidden or system