Hello everyone. I am new here and pretty new to PowerShell as well so please excuse me if this question seems basic.
I have a directory of files that need to be renamed. They all start with a 3 number code and space another 3 number code another space and then some descriptive name that can also contain spaces. I will ultimately need to rename the file to change one or both of the numeric codes in the file names and leave the rest of the file name unchanged.
Example: “021 042 Example File.txt”
My original thought was to just read in the file name as a string and split it based on a space character but that introduced a problem where any spaces in the text description portion of the file name gets split out too so now I don’t have a consistent number of string elements to peice back together again. Does anyone have a better way of doing this? I would like to keep it all native PowerShell commandlets if at all possible.
Your help would be greatly appreciated.