Rename log file using date

Description

This is a simple batch script to to rename a log file and add the date to the new name as a prefix. I use this script to rename my daily automated transfer log files. Schedule it once a week to make log handling more manageable. Great for program logs that do not have a name by date function.

About the Author

Source Code

Important Note:
This script has not been checked by Spiceworks. Please understand the risks before using it.

1

2

3

4

5

6

7

8

9

10

:: Batch Script to rename your a log file and add the current date as a prefix.:: Change LOGFILE variable to point to your log file. :: Run in log file directory.@echooffsetLOGFILE=yourlogfile.log
for/f"tokens=1-5 delims=/ "%%d in ("%date%") do rename %LOGFILE%%%e%%f%%g_%LOGFILE%