RENToday
Purpose
Changes the name of one or more files to today's date/time. The number of renamed files is returned
via the ERRORLEVEL environment variable.
The (new) file name is created in the format YearMonthDay_HourMinuteSecond_Millisecond,
e.g. 20161109_120136_244.log. The millisecond part ensures unique file names, when used to rename
files in a directory. To further prevent equal name collissions, a forced three
millisecond delay has been implemented.
Example in a batch file, assuming three *.log files in the target folder:
RENToday /d=.\data\logs\*.log
ECHO From batch: %ERRORLEVEL% file(s) renamed.
... results in ...
• RENToday v1.6.0 •
Copyright © 2002-2018 by BasicAware. All rights reserved.
Written by Knuth Konrad
Source directory: .\data\logs\*.log
Overwrite : False
Prefix :
-- Scanning folder .\data\logs
Renaming .\data\logs\sa3423.log
-> .\data\logs\20161109_115656_529.log
Renaming .\data\logs\sa3424.log
-> .\data\logs\20161109_115656_544.log
Renaming .\data\logs\sa3444.log
-> .\data\logs\20161109_115656_560.log
File(s) renamed: 3
From batch: 3 file(s) renamed.
Download
RENToday
Installation
None. Download the ZIP file, extract the included executable and run it.
Please note: this is a console application. You should run it from a command prompt.
Use case(s)
-
-
Create unique (chronological) copies of files. Some applications for example create log files with a fixed
file name. In order to keep different historical backups of these logs, RENToday can be used to
create differently named copies of this file.
-
I personally use this tool to create/keep backups of Firefox's bookmarks database. That file is a SQLite database
named places.sqlite and is located in the ((Firefox) profile folder.
Syntax
RENToday /f=<Filename>|/d=<Directory with file spec> [/p=<Prefix>] [/o]
Examples
RENToday /f=C:\MyApplication\Application.log /o
Assuming the current date and time (at this server), Application.log will be renamed to 20241214_015924_480.log.
RENToday /f=C:\MyApplication\Application.log /p=LOG_ /o
Assuming the current date and time (at this server), Application.log will be renamed to LOG_20241214_015924_480.log.
RENToday /f=C:\MyApplication\Application.log /p=LOG_*_ /o
Assuming the current date and time (at this server), Application.log will be renamed to LOG_Application_20241214_015924_480.log.
Source code
The PowerBASIC source code is available at Github
Known issues / limitations
Version
-
1.6.0 - April 2018
-
Parameter /p has been extended to support the wildcard '*'.
-
1.5.2 - May 2017
-
Compiler glitch workaround.
-
1.5 - November 2016