Picking the right verb

Welcome Forums General PowerShell Q&A Picking the right verb

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

 
Participant
10 months, 1 week ago.

  • Author
    Posts
  • #91208

    Participant
    Points: 0
    Rank: Member

    Dear PowerShell experts,

    I am currently getting started in PowerShell and there's still much to learn. I have written a short script that compares two paths $a and $b and then outputs all the absolute paths in $b which are files that either do not exist in $a or are files which have different content than in $a.

    As PowerShell seems to be very serious about the correct verbs [1], I am unsure of what kind of verb this behaviour would be. I think I should pick a verb from the common section and among those are Get, Select or maybe Join. Compare (from the Data section) also makes sense to me.

    Can you please explain me what the right choice would be?

    Many thanks in advance.

    [1] https://msdn.microsoft.com/en-us/library/ms714428(v=vs.85).aspx

  • #91211

    Keymaster
    Points: 1,638
    Helping HandTeam Member
    Rank: Community Hero

    Think about what the output is, and whether any system configuration change is taking place. If all you're doing is analyzing and outputting objects that demonstrate a difference, then Compare- would be the usual verb. Compare-PathContents, perhaps.

  • #91258

    Participant
    Points: 0
    Rank: Member

    Thank you very much.

The topic ‘Picking the right verb’ is closed to new replies.