Pass string or string array to a function in Powershell

Viewed 16201

I hope this is a simple question. I have a Powershell function that operates on all files in a given folder. There are times when I would like to have the function operate on a single folder and times when I would like it to operate on several folders, the paths of which are stored in an array. Is there a way to have one function be able to accept both a single element and an array?

Do-Stuff $aSingleFolder

Do-Stuff $anArrayofFolders
3 Answers
Related