Computing.Net > Forums > Disk Operating System > Create a directory in DOS with Mont

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 a directory in DOS with Mont

Reply to Message Icon

Name: Sangeeth
Date: February 24, 2009 at 02:23:14 Pacific
OS: Windows XP
Subcategory: General
Comment:

How to create a directory in DOS with its name as Month.
It should pick from date, dynamically
say if the date is 24-02-2009 it should create a directory by picking the month as "Feb"

help me in this regard



Sponsored Link
Ads by Google

Response Number 1
Name: Valerie (by Garibaldi)
Date: February 24, 2009 at 18:44:07 Pacific
Reply:

You have posted your query in the Dos forum. Which version of Dos are you using? Your Operating System is shown as Windows XP which is not Dos based. Do you mean you want a script for use in XP?


0

Response Number 2
Name: Sangeeth
Date: February 24, 2009 at 21:15:21 Pacific
Reply:

Hi,
My OS is Windows XP,
format of the date displayed is
"Wed 02/25/2009" (without double quotes).
I need a script to get the month as "Feb".
I cannot change the date display format, etc.
it is controled by administrators.

pls help me.


0

Response Number 3
Name: Valerie (by Garibaldi)
Date: February 24, 2009 at 22:57:29 Pacific
Reply:

Below is one way of getting the alpha month and creating a directory.

:: Code begins....
@echo off
cls

for /f "tokens=1-4 delims=/ " %%A in ("%date%") do (
       set mth=%%B
)

for /f "tokens=%mth%" %%1 in (
       "Jan Feb Mar Apl May Jun Jul Aug Sep Oct Nov Dec") do (
       set mthalpha=%%1
)

Echo Alpha Month = %mthalpha%
md %mthalpha%

:: Code ends....

Good luck.


0

Response Number 4
Name: Mechanix2Go
Date: February 25, 2009 at 06:17:54 Pacific
Reply:

This should work for most versions of DOS from about 3.1 and later.
==============================================

@echo off

@echo off > d.d

>> d.d echo E 0100 B4 2A CD 21 B4 4C CD 21
>> d.d echo N DAY.COM
>> d.d echo RCX
>> d.d echo 8
>> d.d echo W
>> d.d echo E 0100 B4 2A CD 21 88 F0 B4 4C CD 21
>> d.d echo N MONTH.COM
>> d.d echo RCX
>> d.d echo A
>> d.d echo W
>> d.d echo E 0100 B4 2A CD 21 89 C8 B4 4C CD 21
>> d.d echo N YEAR.COM
>> d.d echo RCX
>> d.d echo A
>> d.d echo W
>> d.d echo E 0100 B4 2A CD 21 88 D0 B4 4C CD 21
>> d.d echo N DAT.COM
>> d.d echo RCX
>> d.d echo A
>> d.d echo W
>> d.d echo Q

debug < d.d > nul
del d.d

dat
for %%a in (1 2 3 4 5 6 7 8 9 ) do if errorlevel %%a set dat=0%%a
for %%a in ( 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) do if errorlevel %%a set dat=%%a
echo Date %dat%

day
if errorlevel 0 set day=Sunday
if errorlevel 1 set day=Monday
if errorlevel 2 set day=Tuesday
if errorlevel 3 set day=Wednesday
if errorlevel 4 set day=Thursday
if errorlevel 5 set day=Friday
if errorlevel 6 set day=Saturday
echo Day %day%

month
for %%a in (1 2 3 4 5 6 7 8 9 ) do if errorlevel %%a set month=0%%a
for %%a in ( 10 11 12) do if errorlevel %%a set month=%%a

if %month%==01 set MMM=Jan
if %month%==02 set MMM=Feb
if %month%==03 set MMM=Mar
if %month%==04 set MMM=Apr
if %month%==05 set MMM=May
if %month%==06 set MMM=JUn
if %month%==07 set MMM=Jul
if %month%==08 set MMM=Aug
if %month%==09 set MMM=Sep
if %month%==10 set MMM=Oct
if %month%==11 set MMM=Nov
if %month%==12 set MMM=Dec

echo MMM %MMM%
echo Month %month%

year
if errorlevel 215 set Year=2007
if errorlevel 216 set Year=2008
if errorlevel 217 set Year=2009
if errorlevel 218 set Year=2010
echo Year %Year%

del day.com
del month.com
del year.com
del dat.com

md %MMM%


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

M2


0

Response Number 5
Name: Valerie (by Garibaldi)
Date: February 25, 2009 at 13:32:55 Pacific
Reply:

Thank you M2G. Your contri works well in MS-Dos 7.10 and in XP Cmd.exe.


0

Related Posts

See More



Response Number 6
Name: Sangeeth
Date: February 26, 2009 at 05:05:06 Pacific
Reply:

thanks a lot,
it works.
It helps me a lot in backup of data.
thanks


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: Create a directory in DOS with Mont

how to create a directory in dos www.computing.net/answers/dos/how-to-create-a-directory-in-dos/11381.html

how to rename a directory in DOS www.computing.net/answers/dos/how-to-rename-a-directory-in-dos/5381.html

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