find a specific folder on a file server

This topic contains 3 replies, has 3 voices, and was last updated by  random commandline 1 year, 5 months ago.

  • Author
  • #59454


    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?

  • #59463

    Sonny Puijk

    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}
  • #59469


    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?

  • #59493

    random commandline

    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

You must be logged in to reply to this topic.