Computing.Net > Forums > Disk Operating System > Create directory named toda'y 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.

Create directory named toda'y date

Reply to Message Icon

Name: Jason
Date: May 12, 2003 at 18:36:46 Pacific
OS: XP
CPU/Ram: p3-667/256
Comment:

Hello, is it possible to create a directory with today's date and time as a name?




Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: May 13, 2003 at 14:35:06 Pacific
Reply:

You mean automatically, with a batch file? Use this:

@echo off
for /F "tokens=2-4 delims=/- " %%A in ('date/T') do md %%A%%B%%C

That should create a new directory under the current, with the current date as name, on the format MMDDYYYY. Swap the variables on the last part of the batch script above (%%A %%B and %%C) to change that format.

That method will only work on NT systems.

-- Leonardo Pignataro - Secret_Doom --

secre_doom@hotmail.com
www.batch.hpg.com.br

____________________________________________________________________


0

Response Number 2
Name: QBasic
Date: May 14, 2003 at 18:02:06 Pacific
Reply:

Good answer!

But I would argue that all dates should be in the format yyyymmdd so they sort in the correct order when the year changes.

Nobody should ever in their lifetime for any reason put the year last.

Not to mention that the whole year should be given, not "03". I hope we learned something from the Y2K problem, but I doubt it. I see dates like this 05/14/03

Idiots!

:-) Mac


0

Response Number 3
Name: Secret_Doom
Date: May 16, 2003 at 18:02:49 Pacific
Reply:

Yeah, I agree that the date format mm/dd/yyyy, used in US, is absolutely senseless. The formats yyyy/mm/dd, as you mentioned, or even dd/mm/yyyy are much more logic.

I just used such format on my example because it would be like the user system's date format (actually that method isn't 100% accurate and if the system date format is different than mm/dd/yyyy, the combo %%A%%B%%C will represent that different format, not mm/dd/yyyy).

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


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: Create directory named toda'y date

corrupted file/directory names in dos mo www.computing.net/answers/dos/corrupted-filedirectory-names-in-dos-mo/6827.html

Variables in directory names www.computing.net/answers/dos/variables-in-directory-names/10962.html

Creating Directories www.computing.net/answers/dos/creating-directories/13098.html