Computing.Net > Forums > Disk Operating System > DOS batch line to rename with date

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.

DOS batch line to rename with date

Reply to Message Icon

Name: james taylor
Date: June 27, 2006 at 03:58:44 Pacific
OS: DOS
CPU/Ram: N/A
Product: N/A
Comment:

Hi,
Is anyone able to tell me if there is a way that I can use a batch file command to rename a directory with the current date and time?

I want to be able to execute this batch file so that every time it creates a new folder that is unique to the date and time when it was created, thus not deleting the previous folder.

Any help or guidance to an application that does this would be greatly appreciated.

Regards,

James



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: June 27, 2006 at 06:26:36 Pacific
Reply:

It depends a lot on the version of DOS.

And the language, codepage and a few other things.

Post what you get with this:

time
[enter]
[enter]

date
[enter]
[enter]



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

M2


0

Response Number 2
Name: james taylor
Date: June 27, 2006 at 07:05:37 Pacific
Reply:

Hi that works fine in terms of displaying the date and time but doesn't give me the ability to use those values as the name of a new directory. I am actually using XP and running from a command prompt. I guess I will need to write a simple application in a programming language. It would have been nice if if was already available though.

Thanks,

James


0

Response Number 3
Name: Mechanix2Go
Date: June 27, 2006 at 07:17:27 Pacific
Reply:

Since you're using XP, post the outputs of:

echo %time%
echo %date%


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

M2


0

Response Number 4
Name: james taylor
Date: June 27, 2006 at 07:34:18 Pacific
Reply:

Thats exactly the values i want

How can I get these values to become the name of a new directory, is it possible to include these with the rename command of DOS?

Is there another way?

Thanks,

James


0

Response Number 5
Name: dtech10
Date: June 30, 2006 at 05:33:34 Pacific
Reply:

Hi James
This Help, the For Loops are on one line.
@echo off
rem Make Directory With Name Date and Time
for /f "tokens=1-3 delims=/- " %%a in ('date /t') do set XDate=%%a-%%b-%%c

for /f "tokens=1-2 delims=: " %%a in ('time /t') do set XTime=%%a.%%b
echo %XDate% %XTime%
md "%Xdate% %XTime%"


0

Related Posts

See More



Response Number 6
Name: Mechanix2Go
Date: June 30, 2006 at 05:40:18 Pacific
Reply:

Hi dtech10,

Yer

I asked twice for the date layout and never got it.


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

M2



0

Sponsored Link
Ads by Google
Reply to Message Icon






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: DOS batch line to rename with date

a batch file to rename certain files www.computing.net/answers/dos/a-batch-file-to-rename-certain-files/10372.html

batch file to rename a file www.computing.net/answers/dos/batch-file-to-rename-a-file/8524.html

batch file to rename files by date. www.computing.net/answers/dos/batch-file-to-rename-files-by-date/5517.html