2015-05-19 85 views
1

我有子文件夹和子文件夹。在subsubfolders中,我想查找所有没有名为PKA.dump的文件的子文件夹。这可以在PowerShell中完成吗?在PowerShell中查找没有某个文件的文件夹

的子文件夹角度1,Angle2,等上去Angle24

的subsubfolders从电子伏特,为2eV去,到150eV。

时,他们不到一定规模,我可以找到:

Get-Childitem -path . -filter "PKA.dump" -recurse | where {$_.Length -le 500} 

但是,如果他们不存在?

回答

3

如果您只有2级目录,请不要递归。做这样的事情,而不是:

Get-ChildItem -Path . -Directory | Get-ChildItem -Directory | ? { 
    -not (Test-Path -LiteralPath (Join-Path $_.FullName 'PKA.dump')) 
} 
+0

太棒了!作品非常好!谢谢! – Jack

0

进行更深层次的文件夹结构,这应该是确定:

Get-ChildItem -Path C:\yourpath\ -recurse | where {$_.psiscontainer} | % { 
if((Get-ChildItem -Path $_.FullName -File).name -notcontains "pka.dump"){ $_.FullName } 
} 
相关问题