Re: create folder using date

  • Thread starter Thread starter Phil Robyn
  • Start date Start date
P

Phil Robyn

Johnny said:
I have posted this in windows.server.scripting, but felt
that I may get an answer here as well.

I am trying to use WSH to rename/move a directory to
today's date (i.e. 07242003 or 07.24.2003) using a date
variable (this is to be run everyday).

I am hitting the wall in finding a variable that will do
this in VBS, or in DOS batch.

Here is a sample of the code (vbs) that I am working with:

' Create Destination Folder
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CreateFolder("C:\logs\overnight\today")

' Move Destination Folder to Dated Name
objFSO.MoveFolder "C:\logs\overnight\today" , "C:\l
ogs\overnight\%date%"

I have the dos variable %date% in the place of the code
snippet that I am missing.

Any help would be appreciated!

-John

'DOS' batch (Win2000, WinXP):

ren "\your directory" %date:~10,4%-%date:~4,2%-%date:~7,2%
 
Back
Top