ATY Posted May 6, 2005 Posted May 6, 2005 Hi all, First of all, sorry for my crappy English, It's my second language. I am new to this forum and Cuteftp pro. Anyway, I tried to write a script to download files from a server to my local PC. Filename are variable. How could i verify if files are existing? Below is the codes. Thanks for your help. Set MySite = CreateObject("CuteFTPPro.TEConnection") MySite.Protocol = "FTP" MySite.Host = "xxx.xxx.xxx.xxx" MySite.Port = 21 MySite.Login = "test" MySite.Password = "test" MySite.Connect R=Mysite.localExists ("/test/from/*.txt") If ® Then 'msgbox "file exist" 'test if the file exists MySite.Download "/test/from/gcs*", "c:\data" Else '''Msgbox "File doesn't exist1 on client site" Set objEmail = CreateObject("CDO.Message") objEmail.From = "xxxx@hotmail.com" objEmail.To = "xxx.xxx@xxx.com" objEmail.Subject = "test" objEmail.Textbody = "test" objEmail.Send End if Quote
TCH-Thomas Posted May 6, 2005 Posted May 6, 2005 Welcome to the forum, ATY. Sorry, don´t know the answer to this. And your english is fine. Quote
TCH-Bruce Posted May 6, 2005 Posted May 6, 2005 Welcome to the forums ATY Sorry, don't know the answer either. Quote
Guest Serpentine Posted May 6, 2005 Posted May 6, 2005 (edited) Have you tried Set MySite = CreateObject("CuteFTPPro.TEConnection") MySite.Protocol = "FTP" MySite.Host = "xxx.xxx.xxx.xxx" MySite.Port = 21 MySite.Login = "test" MySite.Password = "test" MySite.Connect R = MySite.RemoteExists( "/pub/user/file.txt") If ® Then MsgBox "File exists on remote side" MySite.Download "/test/from/gcs*", "c:\data" Else MsgBox "File doesn't exist on remote side" Set objEmail = CreateObject("CDO.Message") objEmail.From = "xxxx@hotmail.com" objEmail.To = "xxx.xxx@xxx.com" objEmail.Subject = "test" objEmail.Textbody = "test" objEmail.Send End if Note, I just combined what you gave with what I found at this site. Your English is better than most of the people I know. Edited May 6, 2005 by Serpentine Quote
ATY Posted May 6, 2005 Author Posted May 6, 2005 Serpentine, Yes i had tried the code below. This work only if you know the exactly file name R = MySite.RemoteExists( "/pub/user/file.txt") But in my case, I don't know the file name... Thank you all for quick response. Quote
abinidi Posted May 6, 2005 Posted May 6, 2005 Sorry I don't know the answer, but welcome to the forums. I'm sure somebody around here will be able to help. Quote
TweezerMan Posted May 7, 2005 Posted May 7, 2005 Welcome to the forums, ATY! I looked at the link Serpentine provided - it appears to me that if you don't know the file name(s), you'd first need to retrieve a directory listing with GetList, then you could download whatever filenames appear in the listing. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.