I'm new to PowerShell. I have files in a folder with one-up numbers. I'm trying to find the file with the highest number and change that name.
I'm able to return the file with the following command:
Get-ChildItem -Path C:\Temp\Wayne\Folder1\File*.txt |
Sort-Object |
Select-Object -Last 1 -ExpandProperty Name
it returns:
Get-ChildItem -Path C:\Temp\Wayne\Folder2\File*.txt |
Sort-Object |
Select-Object -Last 1 -ExpandProperty Name
PS C:\> File0005.txt
I would like to change File0005.txt
, to FileCHANGED(TodaysDate).txt
, then move it to C:\Temp\Wayne\Folder1\File*.txt
I'm able to return the correct file, but before I can get to the point of moving it, I'm stuck at trying to rename it.