I am trying to capture the system date and use it as the name of a new folder. I can't get the syntax right. I am trying to insert the date where I have placed the ?'s. Any help or ideas would be appreciated.
option explicit
'Variables
dim oCrntDate
dim oCrtFldr
dim oSource
dim oDest
Dim lfsObject
Dim lFileList
Dim lFolder
Dim lFile
oSource = "c:\Test\source"
oCrntDate = Date
'Create Folder
set oCrtFldr = CreateObject("Scripting.FileSystemObject"
set oDest = oCrtFldr.CreateFolder ("\\Server1\Test\?????"
'Copy Files
on error resume next
Set lfsObject = CreateObject("Scripting.FileSystemObject"
Set lFolder = lfsObject.GetFolder(oSource)
Set lFileList = lFolder.Files
For Each lFile in lFileList
lfsObject.CopyFile oSource & "\" & lFile.Name, oDest & "\" & lFile.Name
next
option explicit
'Variables
dim oCrntDate
dim oCrtFldr
dim oSource
dim oDest
Dim lfsObject
Dim lFileList
Dim lFolder
Dim lFile
oSource = "c:\Test\source"
oCrntDate = Date
'Create Folder
set oCrtFldr = CreateObject("Scripting.FileSystemObject"
set oDest = oCrtFldr.CreateFolder ("\\Server1\Test\?????"
'Copy Files
on error resume next
Set lfsObject = CreateObject("Scripting.FileSystemObject"
Set lFolder = lfsObject.GetFolder(oSource)
Set lFileList = lFolder.Files
For Each lFile in lFileList
lfsObject.CopyFile oSource & "\" & lFile.Name, oDest & "\" & lFile.Name
next