Emmanuel
Master Tech
- Local time
- Yesterday, 20:15
- Joined
- Sep 4, 2002
- Messages
- 88
Hey guys,
I have this piece of code which works fine to pull the files from the remote server if the server is available. However, this server is taken down several times a week for back up and maintenance. My problem is that when this script runs and the server is down, I just get a "Path not found" error and the process stops. Can any of you help me with building something in there that says "If the path is not found, close the script"?
Thank you in advance for your help.
This is my code:
dim objFSO, f1, f, fc, strSourceFolder, strDestFolder, strlOOKFile, strlOOKFolder
'Constants
Const OverwriteExisting = TRUE
'Global variables
'********* This section for test only ****************
'strSourceFolder = "C:\Documents and Settings\intadmin\Desktop\ftp1\*.FLG"
'strlOOKFolder = "C:\Documents and Settings\intadmin\Desktop\ftp1\"
'********* Test section ends *************************
strSourceFolder = "\\tbstpabc\D\ftp1\*.FLG"
strlOOKFolder = "\\tbstpabc\D\ftp1\"
'strlOOKFile = "ISMSAGA.FLG"
strDestFolder = "C:\Documents and Settings\me\Desktop\ftp1\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set f = objFSO.GetFolder(strlOOKFolder)
Set fc = f.Files
For Each f1 in fc
If objFSO.GetExtensionName(lcase(f1.name)) = "flg" Then
objFSO.CopyFile strSourceFolder , strDestFolder , OverwriteExisting
Else
End If
Next
I have this piece of code which works fine to pull the files from the remote server if the server is available. However, this server is taken down several times a week for back up and maintenance. My problem is that when this script runs and the server is down, I just get a "Path not found" error and the process stops. Can any of you help me with building something in there that says "If the path is not found, close the script"?

Thank you in advance for your help.
This is my code:
dim objFSO, f1, f, fc, strSourceFolder, strDestFolder, strlOOKFile, strlOOKFolder
'Constants
Const OverwriteExisting = TRUE
'Global variables
'********* This section for test only ****************
'strSourceFolder = "C:\Documents and Settings\intadmin\Desktop\ftp1\*.FLG"
'strlOOKFolder = "C:\Documents and Settings\intadmin\Desktop\ftp1\"
'********* Test section ends *************************
strSourceFolder = "\\tbstpabc\D\ftp1\*.FLG"
strlOOKFolder = "\\tbstpabc\D\ftp1\"
'strlOOKFile = "ISMSAGA.FLG"
strDestFolder = "C:\Documents and Settings\me\Desktop\ftp1\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set f = objFSO.GetFolder(strlOOKFolder)
Set fc = f.Files
For Each f1 in fc
If objFSO.GetExtensionName(lcase(f1.name)) = "flg" Then
objFSO.CopyFile strSourceFolder , strDestFolder , OverwriteExisting
Else
End If
Next