Reputation: 3215
I am using PowerShell's rename-item command to change a file extensions as follows, but it doesn't update the timestamp on the file:
Get-Item 'C:\mytest.config' | Rename-Item -NewName { $_.name -Replace '\.config','.config.disabled' }
Does rename-item not update the timestamp, and if so, how can I update the timestamp when I rename a file using the method above?
Upvotes: 0
Views: 444
Reputation: 21
Renaming a file doesn't update its Last Modified timestamp.
However, you can update the timestamp using this in PowerShell:
(Get-Item '.\example.txt').LastWriteTime = Get-Date
Upvotes: 2