Can someone provide me some advice on how to improve efficency of my remove-tempfiles script, specifically around the looping and removing of files?
Currently, I loop through all the folders and gather the list of files to remove, slap them in an array, and then I run through it again removing the files if $Commit is true. Would it be more efficent to run through the folders, and if $commit = true then remove the file found?
I’m not specifically looking for the exact answer or code snippet - more about ways to approach this so I can attempt it and learn from it.
Thanks in advance,