Using the following Powershell code, I'm trying to locate folders which do NOT contain robots.txt in the root. Normally, I could do this recursively but it's taking FOREVER to recurse this massive folder structure. What I really need is only the first level, AKA search only the folders found in C:\Projects.
Basically I need to get children from each set of children, and only then return parents where there was no robots.txt file. The problem I'm having here is my $_ in the nested for loop is giving me the CWD, not the children of the directory I'm searching. I know I might have to use a -Where here but I'm a little over my head and pretty new to powershell. Any help is appreciated!
$drv = gci C:\Projects | %{
$parent = $_; gci -exclude "robots.txt" | %{$_.parent}} | gu