im still learning VB but i am having i have about given up adding the current year month and date to the target folder this robocopy script i am using
for example my target folder name is E:\Preservations\Ronald_McDonald\Hostname i want it to append the year month and date to the folder like E:\Preservations\Ronald_McDonald\Hostname_20160322
below is the script i am using.
for example my target folder name is E:\Preservations\Ronald_McDonald\Hostname i want it to append the year month and date to the folder like E:\Preservations\Ronald_McDonald\Hostname_20160322
below is the script i am using.
Code:
Set objShell = CreateObject("Wscript.Shell")
objSource = InputBox("Please enter the Path to the source Data: Example: \\Hostname\c$", _
"Source Folder")
If objSource = "" Then
Wscript.Quit
Else
MsgBox objSource, 0, "Source Path"
End If
objDestination = InputBox("Please enter the Path to Destination Folder: Example: C:\Target\Data", _
"Destination Folder")
If objDestination = "" Then
Wscript.Quit
Else
MsgBox objDestination, 0, "Target Path"
End If
objlogpath = InputBox("Please enter the Path and name where the log will be placed: Example: C:\script_path\hostname.txt", _
"Path and log name")
If objlogpath = "" Then
Wscript.Quit
Else
MsgBox objlogpath, 0, "Log Path"
End If
objcmd = "Robocopy"
objSource = """" & objSource & """"
objDestination = """" & objDestination & """"
objswitches = " /B /S /COPY:DATO /DCOPY:T /R:2 /W:5 /V /TEE"
objlogpath = "/log:" & objlogpath
objCommand = objcmd & Chr(32) & objSource & Chr(32) & objDestination & Chr(32) & objswitches & Chr(32) & objlogpath
Wscript.echo objCommand
objShell.Run(objCommand)