Adding date to the name of files and folders
Go to solution
Solved by Jacques Cartier,
1 hour ago, Joshua said:Hi Jacques, we had a similar conversation a few days ago regarding searching a filename.
KCDaRookie on Reddit found the solution:
#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% }
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now