find a specific folder on a file server

This topic contains 3 replies, has 3 voices, and was last updated by Profile photo of random commandline random commandline 7 months, 3 weeks ago.

  • Author
    Posts
  • #59454
    Profile photo of Jeremy-Smit
    Jeremy-Smit
    Participant

    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
    Profile photo of Sonny Puijk
    Sonny Puijk
    Participant

    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
    Profile photo of Jeremy-Smit
    Jeremy-Smit
    Participant

    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
    Profile photo of random commandline
    random commandline
    Participant

    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.