#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
SelFile = %1%
FileGetTime, FileTimeStamp, %SelFile%
FormatTime FileTimeStamp,%FileTimeStamp%, yyyy-MM-dd
FileGetAttrib, IsFolder, %SelFile%
If InStr(IsFolder, "D" )
{
NewName := RegExReplace(SelFile, "$"," - " . FileTimeStamp)
FileMoveDir, %SelFile%, %NewName%
}
Else
{
NewName := RegExReplace(SelFile, "(\.[^\.]+)$"," - " . FileTimeStamp . "$1")
FileMove, %SelFile%, %NewName%
}