[SOLVED] Adding date to the name of files and folders

mcqc

Distinguished
Mar 9, 2010
45
0
18,540
Hi, I would like to add the "Date Created" or "Date Modified" to any files or folders. Possibly by right-clicking on it and running a script from the context menu. Can that be done with autohotkey, batch file or VBS ? Any help would be appreciated

example: "test.txt" to "test 2020-10-19.txt"
 
Solution
Why do you need to use that one specific application, when this other tool apparently does exactly what you seek.

Set up the rules, select a bunch of files, click...renamed.
KCDaRookie on Reddit found the solution:

Code:
#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...

USAFRet

Titan
Moderator
Hi, I would like to add the "Date Created" or "Date Modified" to any files or folders. Possibly by right-clicking on it and running a script from the context menu. Can that be done with autohotkey, batch file or VBS ? Any help would be appreciated

example: "test.txt" to "test 2020-10-19.txt"
Advanced Renamer can probably do this.
https://www.advancedrenamer.com/user_guide/tags_datetime
 

mcqc

Distinguished
Mar 9, 2010
45
0
18,540
Thanks for the help. I already use free commander. I need to open commander, navigate to the file, click on file, multirename, select profiles, rename and quit. I want to speed up the process. Right-click, click on the script.
 

USAFRet

Titan
Moderator
Thanks for the help. I already use free commander. I need to open commander, navigate to the file, click on file, multirename, select profiles, rename and quit. I want to speed up the process. Right-click, click on the script.
Why do you need to use that one specific application, when this other tool apparently does exactly what you seek.

Set up the rules, select a bunch of files, click...renamed.
 

mcqc

Distinguished
Mar 9, 2010
45
0
18,540
Why do you need to use that one specific application, when this other tool apparently does exactly what you seek.

Set up the rules, select a bunch of files, click...renamed.
KCDaRookie on Reddit found the solution:

Code:
#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%
}
 
Solution

TRENDING THREADS