Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Create dynamic directories using date  (Read 4334 times)

0 Members and 1 Guest are viewing this topic.

David Enriquez

  • Guest
Create dynamic directories using date
« 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??

MalikTous

  • Guest
Re: Create dynamic directories using date
« Reply #1 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.