Hello all,
Still working my way through various scripts and I needed some information on why my code is asking for a file or directory upon creation
When I get to the line of code highlighted here in red it brings up a DOS window with the following prompt
Does C:\Depot-Old specify a file name or directory on the target
(F = file, D = directory)?
'========================Script=============================
'----------------------- Header Section --------------------------
'Option Explicit
'On Error Resume next
Dim objNetwork
Dim objFso
Dim objFolder
Dim sFPath
Dim dFPath
Dim objShell
Dim strDirectory
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("Wscript.Network")
Set objShell = CreateObject("wscript.shell")
FromShr = "\\Enterprise\Depot"
FromPfx = "\\EnterPrise"
deptshr = "\\Enterprise\Depot1"
strBackup = "C:\Depot-old"
fsPath = "c:"
'------------------------ Reference Section --------------------
Wscript.echo(strBackup)
If objFso.FolderExists(FromShr) Then
Wscript.Echo(deptShr)
call DepotCopShare
Else
Wscript.Echo("This share is not valid")
End if
Sub DepotCopShare
Set objFso = CreateObject("Scripting.FileSystemObject")
objNetwork.MapNetworkDrive "", deptShr
objNetwork.MapNetWorkDrive "", FromShr
wscript.echo("checkpoint")
If objFso.FolderExists("C:\Depot-Old\") Then
objShell.Run "Xcopy \\Enterprise\Depot1\*.* /S \\Enterprise\Depot-Old /I /y"
objShell.Run "Xcopy \\Enterprise\Depot\*.* /S \\Enterprise\Depot1 /O /y"
Else
objFso.CreateFolder(strBackup)
End If
objShell.Run "Xcopy \\Enterprise\Depot1\*.* /S C:\Depot-Old /y"
End If
End Sub
Still working my way through various scripts and I needed some information on why my code is asking for a file or directory upon creation
When I get to the line of code highlighted here in red it brings up a DOS window with the following prompt
Does C:\Depot-Old specify a file name or directory on the target
(F = file, D = directory)?
'========================Script=============================
'----------------------- Header Section --------------------------
'Option Explicit
'On Error Resume next
Dim objNetwork
Dim objFso
Dim objFolder
Dim sFPath
Dim dFPath
Dim objShell
Dim strDirectory
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("Wscript.Network")
Set objShell = CreateObject("wscript.shell")
FromShr = "\\Enterprise\Depot"
FromPfx = "\\EnterPrise"
deptshr = "\\Enterprise\Depot1"
strBackup = "C:\Depot-old"
fsPath = "c:"
'------------------------ Reference Section --------------------
Wscript.echo(strBackup)
If objFso.FolderExists(FromShr) Then
Wscript.Echo(deptShr)
call DepotCopShare
Else
Wscript.Echo("This share is not valid")
End if
Sub DepotCopShare
Set objFso = CreateObject("Scripting.FileSystemObject")
objNetwork.MapNetworkDrive "", deptShr
objNetwork.MapNetWorkDrive "", FromShr
wscript.echo("checkpoint")
If objFso.FolderExists("C:\Depot-Old\") Then
objShell.Run "Xcopy \\Enterprise\Depot1\*.* /S \\Enterprise\Depot-Old /I /y"
objShell.Run "Xcopy \\Enterprise\Depot\*.* /S \\Enterprise\Depot1 /O /y"
Else
objFso.CreateFolder(strBackup)
End If
objShell.Run "Xcopy \\Enterprise\Depot1\*.* /S C:\Depot-Old /y"
End If
End Sub