dos batch files
#1
Scooby Regular
Thread Starter
Join Date: Sep 2002
Location: Essexville
Posts: 4,391
Likes: 0
Received 0 Likes
on
0 Posts
hi folks,
can someone help me with a batch file, that renames a file and datestamps it.
ie a .log file and renames to 25_06_03.log
or something like that
using the rename command line ...
then i can schedule it from there..
??
cheers in advance
BB
can someone help me with a batch file, that renames a file and datestamps it.
ie a .log file and renames to 25_06_03.log
or something like that
using the rename command line ...
then i can schedule it from there..
??
cheers in advance
BB
#3
Scooby Regular
Join Date: Jul 2003
Location: www.irally.net
Posts: 253
Likes: 0
Received 0 Likes
on
0 Posts
Try this - it may not be pretty but it works
set d1=%date%
set dd=%d1:~4,2%_
set mm=%d1:~7,2%_
set yy=%d1:~12,2%
set fd=%dd%%mm%%yy%.txt
ren test.txt %fd%
set d1=%date%
set dd=%d1:~4,2%_
set mm=%d1:~7,2%_
set yy=%d1:~12,2%
set fd=%dd%%mm%%yy%.txt
ren test.txt %fd%
#4
pretty much the same as the version I had:
set mydate=%date%
set dd=%mydate:~0,2%_
set mm=%mydate:~3,2%_
set yy=%mydate:~6,4%
set newname=%dd%%mm%%yy%.log
ren sqllog.log %newname%
I guess t all depends on how your server is set up to handle dates!
set mydate=%date%
set dd=%mydate:~0,2%_
set mm=%mydate:~3,2%_
set yy=%mydate:~6,4%
set newname=%dd%%mm%%yy%.log
ren sqllog.log %newname%
I guess t all depends on how your server is set up to handle dates!
Thread
Thread Starter
Forum
Replies
Last Post