Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script prompting for file or directory name

Status
Not open for further replies.

Councilk

MIS
May 14, 2003
72
US
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



 
You have an End If without matching If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PVH,

That's the result of my cleaning up the script and it appears as if I may need to take a different approach with this folder update script
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top