Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

test-path for folder on removable drive root

$
0
0

So I'm creating a GUI app and so far  ( day 1 ) it's working.  What the GUI does is

List removable drives in a drop down
Determines if they are FAT32 or not ( checks a box )
Checks for a specific file that is older than 30 days ( checks a box and displays text in green if good and red if not there out out of date )

What it's not doing:
Searching the removable drives for a folder (Network Drivers) and updating the checkbox and text accordingly 

$removabledrives = [System.IO.DriveInfo]::GetDrives() | ? {$_.DriveType -eq "Removable" }

Shows all the removable devices on my computer = great

output shows E:\ F:\ - which is correct

what I'd like to do is search all of them for a specific folder named Network Drivers that resides on the root of the removable devices. 

when I try,

foreach ($removabledrive in $removabledrives)
{test-path .\Drivers}

it doesn't find the folder.  I figure a picture would help.


Viewing all articles
Browse latest Browse all 6937

Trending Articles