FoxPro Programming
Visual Foxpro SFTP Problem
Gravatar is a globally recognized avatar based on your email address. Visual Foxpro SFTP Problem
  Edward K. Marois
  All
  Mar 7, 2019 @ 10:17am

Dear Rick:

I have down loaded the 'Web Connection' program have managed to figure quite a bit out in a short amount of time. It appears to be amazing and cannot wait to us it fully

But ...

I created a completely external .exe program is its own sub folder to run the SFTP program so that I do NOT have to update all my customers with the new .dlls, which would be a night mare.

Thus I am trying to down load files from a SFTP site and it is down loading a 'blank' file and the program does NOT delete the file off the SFTP site.

We think it is a 'security' issue ... but I have asked the client to correct this like 3 times. Do you think it is something else ???

Thanks for all your help ...

  mFTP_SITE = "sftp.ncb.coop"

  myFTP.FtpConnect(mFTP_SITE, THISFORM.mUSER.Value, THISFORM.mPASSWORD.Value) 

  IF myFTP.nError = 1 THEN
    =MESSAGEBOX(myFTP.cErrorMsg))
  ELSE
  
    WAIT "CONNECTED" WINDOW TIMEOUT .5
  
    DO CASE
      CASE THISFORM.mL1.Value = "S"   &&  --  Send
        
 ** This part is working Great      

      CASE THISFORM.mL1.Value = "R"   &&  --  Recieve
      
        LOCAL lcFtpSourceFile AS String
        LOCAL lcLocalTargetFile AS String
       
      * o.FtpDeleteFile(lcFile)
      
      *"C:\RISWIN\NCB\"
      
        loFiles = myFTP.FtpListFiles("")  && or: "/subfolder" or "subfolder2" (relative)
        IF ISNULL(loFiles) = .F. THEN
          FOR EACH loFile IN loFiles FOXOBJECT
            lcFtpSourceFile = ALLTRIM(loFile.Name)
            mLEN = LEN(lcFtpSourceFile)
            IF RIGHT(lcFtpSourceFile,3) = "txt" THEN
              lcLocalTargetFile = "C:\RISWIN\NCB\" + lcFtpSourceFile 
              myFTP.FtpGetFileEx(lcFtpSourceFile, lcLocalTargetFile)
              WAIT lcLocalTargetFile WINDOW TIMEOUT .5
              myFTP.FtpDeleteFile(lcFtpSourceFile)
            ENDIF 
          ENDFOR
          WAIT "RECIEVED" WINDOW TIMEOUT 1
        ELSE
          =MESSAGEBOX(ALLTRIM(myFTP.cErrorMsg) + " FtpListFiles")
        ENDIF
   
    ENDCASE	
  
  ENDIF  
	   
  myFTP.FtpClose()
 
  myFTP.Destroy 
  
  WAIT "DONE" WINDOW TIMEOUT 1
Gravatar is a globally recognized avatar based on your email address. re: Visual Foxpro SFTP Problem
  Rick Strahl
  Edward K. Marois
  Mar 7, 2019 @ 12:21pm

Hi Edward,

Please, in the future format your code when you are posting. See the prominent message above the post button.

I have no idea as you're giving no information how it fails. Error message failure, behavior, anything...

+++ Rick ---

© 1996-2019