developer155
Programmer
Hello
I created a VB script with a few batch jobs to copy a file from FTP site. Here is the code. Can someone let me know how to check FTP site for the existance of a file?
1) This is a batch file (called from an sp) that calls vbs file:
d:
cd \activity
\\server\directory\MyScript.vbs
2)
This is VBS file that calls a batch file to get a file from FTP site
Dim objFSO
Dim objTextFile
Dim oScript
Dim strCMD
Dim strFileName
strFileName="\\server\QA\Feed.txt"
On Error Resume Next
' shell command object
Set oScript = Server.CreateObject("WSCRIPT.SHELL")
'Run batch file to connect to FTP site an grab the file
oScript.run "GetFTP.bat"
'Call an application that works with the file
oScript.run (App.exe strFileName)
Set oScript=Nothing
Here is GetFTP.bat (it call another batch)
ftp -s:"FinallyGetFile.bat"
Here is FinallyGetFile.bat
open ftp.Site.com
userID
password
lcd \\server\QA\
get Feed.txt
close
bye
-------------------------------------------
Please let me know if this looks good and also how I can have VB script check if the file actually exist on FTP site before trying to get it
thanks!!!
I created a VB script with a few batch jobs to copy a file from FTP site. Here is the code. Can someone let me know how to check FTP site for the existance of a file?
1) This is a batch file (called from an sp) that calls vbs file:
d:
cd \activity
\\server\directory\MyScript.vbs
2)
This is VBS file that calls a batch file to get a file from FTP site
Dim objFSO
Dim objTextFile
Dim oScript
Dim strCMD
Dim strFileName
strFileName="\\server\QA\Feed.txt"
On Error Resume Next
' shell command object
Set oScript = Server.CreateObject("WSCRIPT.SHELL")
'Run batch file to connect to FTP site an grab the file
oScript.run "GetFTP.bat"
'Call an application that works with the file
oScript.run (App.exe strFileName)
Set oScript=Nothing
Here is GetFTP.bat (it call another batch)
ftp -s:"FinallyGetFile.bat"
Here is FinallyGetFile.bat
open ftp.Site.com
userID
password
lcd \\server\QA\
get Feed.txt
close
bye
-------------------------------------------
Please let me know if this looks good and also how I can have VB script check if the file actually exist on FTP site before trying to get it
thanks!!!