Author Posts

December 6, 2016 at 9:11 am

Hi people,

I want to know if it is possible to check if a specific folder is on a file server / disk

i need to find the follow folder " 11501632 S&S Window Signing Bleeckerstreet "

Anyone an idea how to make a oneline for this?

December 6, 2016 at 10:24 am

That's pretty simple

$PathToSearch = "C:\SomeFolder"
$FolderName = "11501632 S&S Window Signing Bleeckerstreet"
gci -path $PathToSearch -Recurse -directory -ErrorAction SilentlyContinue | where {$_.Name -eq $FolderName}

December 6, 2016 at 12:06 pm

is it possible to mody fy it so that we can say search on disk c or d\
and then with the next popup that you give in the folder name?

December 6, 2016 at 2:11 pm

If you are using PowerShell v.3 or higher, this should work.

$drive = Read-Host 'What drive? ex: C:'
$folder = Read-Host 'What folder? ex: myfolder'
Get-ChildItem -Path $drive -Recurse -Filter *$folder* -Directory