Create a temporary folder in powershell

I needed to create a temporary folder. I modified the code found here https://stackoverflow.com/questions/34559553/create-a-temporary-directory-in-powershell. One issue in the original code was the chance (albeit extremely slight) of having a name collision with an existing folder. The script below checks and tries 5 times before failing. It isn’t neat, and is somewhat of a brute force method of getting around the issue, but it gets the job done. You can see the modified code here https://pastebin.com/DPfj3iT7

Leave a Reply

Your email address will not be published. Required fields are marked *