Creating a folder for today's Date

  • Thread starter Thread starter Micheal
  • Start date Start date
M

Micheal

I am trying to create a folder for today's date in a
batch file. I am using the command md "%date%". in the
command window it display the flowing, E:\System
State>md "Mon 07/14/2003". However when you view the
folder the folders name is Mon 07. I know this is
because you can not use / in folder names. Is there a
way I can get the the the date to generate with dashes
instead of /? ie. Mon 07-14-2003

Thanks

Micheal
 
-----Original Message-----
I am trying to create a folder for today's date in a
batch file. I am using the command md "%date%". in the
command window it display the flowing, E:\System
State>md "Mon 07/14/2003". However when you view the
folder the folders name is Mon 07. I know this is
because you can not use / in folder names. Is there a
way I can get the the the date to generate with dashes
instead of /? ie. Mon 07-14-2003

Thanks

Micheal
.

Micheal,

Use this vbscript :(copy and paste the text to text file
and rename the file to .vbs)

'-------------------------- start ------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
dim fold
GetCurrentDate = FormatDateTime(Date, 2)
dim c,d
for x=1 to 10
c=mid(GetCurrentDate ,x,1)
if c="/" then
d=d&"-"
else
d=d&c
end if
next
'msgbox d
Set objFolder = objFSO.CreateFolder("c:\" & d)
'-------------------------- end -------------------------

for more files and folder script you can visit my site
at :

http://scripts.mutsonline.com

Best Regards

Oren Nizri
 
Back
Top