Picking the right verb

This topic contains 2 replies, has 2 voices, and was last updated by  Jens Mertelmeyer 1 week, 3 days ago.

  • Author
    Posts
  • #91208

    Jens Mertelmeyer
    Participant

    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

    Don Jones
    Keymaster

    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

    Jens Mertelmeyer
    Participant

    Thank you very much.

You must be logged in to reply to this topic.