Powershell to rename files based on laast modified date

Increment outside of the delay-bind script block:

$inc = 1 # Increment
Get-ChildItem -File | Sort LastWriteTime | Foreach-Object {
    $_ | Rename-Item -NewName { "{0} . {1}" -f $inc,$_ } -WhatIf

Remove -WhatIf if you are happy with the rename results.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top