Re: create folder using 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%
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top