Need an idea on how to start (Solved!)

Welcome Forums General PowerShell Q&A Need an idea on how to start (Solved!)

This topic contains 3 replies, has 3 voices, and was last updated by

 
Participant
3 weeks, 1 day ago.

  • Author
    Posts
  • #124749

    Participant
    Points: 42
    Rank: Member

    Hi,

    I have a list of fullnames of some folders, somehting like:
    C:\Temp
    C:\Temp\1
    C:\Universal
    C:\Windows

    And I have another list showing only some of those folders which I have access to:
    C:\Univeral
    C:\Windows

    I wanted to create a table like this:

    Folders           Visible
    _______           _______
    C:\Temp            
    C:\Temp\1          
    C:\Universal      X
    C:\Windows        X
    

    But I'm lost on how to start that...

  • #124757

    Participant
    Points: 90
    Rank: Member

    Hi Vandrey,

    I think something like this should get you close — note: it is untested code

    $AllFolders = Get-Content -Path C:\Temp\AllFolders.txt
    $CheckFolders = Get-Content -Path C:\Temp\CheckFolders.txt
    
    foreach ($f in $AllFolders)
    {
        [pscustomobject]@{
            Folder  = $f
            Visible = $f -in $CheckFolders
        }
    }
    
    

    HTH,
    Steve

    • #125549

      Participant
      Points: 42
      Rank: Member

      stephenmbell,

      Great! Thanks a lot! Sorry for not replying sooner, it was a big holiday here in Brazil.

  • #124790

    Participant
    Points: 246
    Helping Hand
    Rank: Participant

    How about using Compare-Object?

You must be logged in to reply to this topic.