Computing.Net > Forums > Disk Operating System > Rename file with date and increment

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Rename file with date and increment

Reply to Message Icon

Name: pitrio
Date: April 8, 2005 at 23:18:50 Pacific
OS: DOS for win2000 server
CPU/Ram: xeon
Comment:

Hi, i need a batch file for rename a file.
EXAMPLE
i have this file :

log_server.txt

i need rename in: log_server_date_I.txt;log_server_date_II.txt;log_server_date_III.txt ecc (infinte for day)

i use for now this code:


cd C:\Documents and Settings\Administrator\Desktop
@echo off
Rem Get Day,Mth & Year from %Date%
set Day=%Date:~0,2%
set Mth=%Date:~3,2%
set Yr=%Date:~6,4%
ren 1.txt 1_%Day%-%Mth%-%Yr%_I.txt

i need the command for increment the number of the name.

Bye




Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: April 9, 2005 at 00:52:32 Pacific
Reply:

Hi,

I guess it's w2000 cmd.exe

Do you really want to use:

I,II,III...

?

Is the next number IV?

M2


If at first you don't succeed, you're about average.


0

Response Number 2
Name: pitrio
Date: April 9, 2005 at 04:08:28 Pacific
Reply:

beyond to the 4


0

Response Number 3
Name: wizard-fred
Date: April 9, 2005 at 04:42:31 Pacific
Reply:

Only a comment. Roman Numerals will be very hard to do even with a third party application. Also they don't sort when it reaches IX.
Dates are better in the form yyyymmdd. If you are going to roll logs that frequently why not use time hhmm. If you are writing your logging application then the system can automatically name the file, no renaming needed.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Rename file with date and increment

Create file with date and time www.computing.net/answers/dos/create-file-with-date-and-time/13843.html

Rename file with date www.computing.net/answers/dos/rename-file-with-date/14091.html

Rename file with current date www.computing.net/answers/dos/rename-file-with-current-date/13069.html