Computer Hope

Microsoft => Microsoft DOS => Topic started by: David Enriquez on July 27, 2004, 03:57:56 PM

Title: Create dynamic directories using date
Post by: David Enriquez on July 27, 2004, 03:57:56 PM
I need to write a script that creates directories based on the current date. When I use the system variable DATE the slashes are interpreted incorrectly, therefore the new directory becomes 3, eg.

DATE=tue 7/27/2004
set dirvar=%DATE%
md %dirvar%

the directories created are tue 7, 07 and 2004

Any ideas??
Title: Re: Create dynamic directories using date
Post by: MalikTous on July 28, 2004, 12:51:33 PM
The forward slash character is not a legal character in a directory name, and is interpretted as a 'new command' initial.

Use country.sys to choose a date format that uses hyphens or periods to separate the date values, so you get 200407.27, 27-07-04, or something similar as the name of your directory.