Computing.Net > Forums > Disk Operating System > Creating Directories question

Creating Directories question

Reply to Message Icon

Original Message
Name: Dustin Long
Date: May 23, 2003 at 13:30:21 Pacific
Subject: Creating Directories question
OS: DOS
CPU/Ram: Pentium 32
Comment:

How do you create a directory in DOS with the current date as the name? I.E. C:\05232003 This may not be possible but I am trying. Thanks for the help.


Report Offensive Message For Removal


Response Number 1
Name: Petit Jean
Date: May 23, 2003 at 19:49:48 Pacific
Subject: Creating Directories question
Reply: (edit)

http://www.unisyn.com/automate/user/resources/samples/
Search File I/O Simple tasks section and download Create folder by date program.Good luck.


Report Offensive Follow Up For Removal

Response Number 2
Name: Mike Newcomb
Date: May 23, 2003 at 21:21:58 Pacific
Subject: Creating Directories question
Reply: (edit)

I think you mave have found a hiccup in dos and/or windows.

You can create the directory using the MK or MKDIR directory and it will exist. e.g MK 22052003

If it is in a regular dos directory with 8 character names, the DIR command will show it. The file/directory counts are correct.

However, if it is in a directory with longer names, the DIR command does not show it, even though the file/directory counts are correct. To find it, you have to use DIR 2*

I may be wrong, but I seem to remember an early dos rule that directory and/or file names could not begin with a numeric character and possibly this relates to that.

Good luck - keep us posted.


Report Offensive Follow Up For Removal

Response Number 3
Name: x86
Date: May 24, 2003 at 01:00:56 Pacific
Subject: Creating Directories question
Reply: (edit)

http://members.aol.com/axcel216 lots of info on DOS commands..........


Report Offensive Follow Up For Removal

Response Number 4
Name: toyotaco01
Date: May 24, 2003 at 01:39:23 Pacific
Subject: Creating Directories question
Reply: (edit)

i had this exact question below. I found this
for /F "tokens=2-4 delims=/- " %%A in ('date/T') do md "%%A%%B%%C"

for /F "tokens=2-4 delims=/- " %%A in ('date/T') do CD c:\directory path\%%A%%B%%C

i added the second line of code so that I could actually get into the directory. (I had to do this line over and onver again also). I'm new at this batch file stuff, but this worked


Report Offensive Follow Up For Removal

Response Number 5
Name: Secret_Doom
Date: May 24, 2003 at 14:42:48 Pacific
Subject: Creating Directories question
Reply: (edit)

Toyotaco, you don't have to repeat that line of code every time you want to refer to the date stamp. Just save it on an environment variable and use it as you will:

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

And that is indeed a good method to get the date stamp without separators on NT systems. However, if the original poster is really on DOS or Win9x, not just on a DOS emulated environment under windows NT, other ways be used. Read my FAQ for that:

FAQ #02 - Get system's current date into a variable without separators

-- Leonardo Pignataro - Secret_Doom --

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

_____________________________________________________________________________


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Creating Directories question

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge