WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

FTP Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

FTP Directory List

Keywords: 	 ftp directory list

I attach code that works on my server to detect the null directory with no files in it.

No idea the best way for it to help other people.

My Server Host funny they send date as JUN dd hh:mm and the time is sometimes a year. Oh well just have to send some files too often. No idea why these people cannot list the obvious decent date/time information (yyyy:mm:dd:hh:mm:ss).


UserId   = "ve3jjc"
Pswd     = "******"
Host     = "www.lks.net"
AccntId  = "ve3jjc"
Rem_base = "/.public_html/"
FFN_work = "c:\lks_map\rem_list.wrk"
FFN_LOG  = "c:\lks_map\rem_list.jjc" 

AddExtender("WWWSK32I.DLL")
Gosub Dial_and_ftp
If ID_ftp == 0 then RETURN (0)

FID_log  = fileopen(FFN_log,"WRITE")
Max_count = 1
This_Name%Max_count% =  Rem_base
While Max_count > 0
   This_name = This_name%Max_count%
   Max_count = Max_count - 1
   If Fileexist(FFN_work) then Filedelete(FFN_work)
   Data_cnt = 0
   list = ftpList(ID_ftp,"%This_name%",FFN_work)
   If fileexist(FFN_work)
      FID_work = fileopen(FFN_work,"READ")
      If FID_work
         In_line = Fileread(FID_work)
         While In_line <> "*EOF*"
            In_line = Fileread(FID_work)
            If  In_line == "*EOF*" then break
            Parsedata(in_line)
            If strsub(Param1,1,1) == 'd'
               Max_count = Max_count + 1
               This_name%Max_count% = "%This_name%%Param9%/"
             Else
               Data_cnt = Data_cnt + 1
               Filewrite(FID_LOG,"%This_name%%Param9%")
            Endif
         Endwhile
         Fileclose(FID_work)
      Endif
   Endif
   If  Data_cnt == 0 then Filewrite(FID_LOG, This_name)
EndWhile
ftpClose(ID_ftp)


;nRet = dunDisconnect (ID_dial)

Fileclose(FID_log)
RunWait("notepad.exe",FFN_log")

Return 

:Dial_and_ftp ; Sub
   ID_dial = 0
   ID_ftp  = 0

   sDialUps = dunItemize ()
   if (ItemCount(sDialUps,@TAB) == 1)
      sDial = sDialUps
   else
      sDial = AskItemList ("Choose a dial-up connection", sDialUps, @TAB, @SORTED, @SINGLE)
   endif

   ID_dial = dunConnect (sDial)
   if (!ID_dial)
      nErr = wxGetLastErr()
      Display(5," ","Couldn't connect to %ID_dial%. Error %nErr%.")
      Return 
   Endif

   ID_ftp =ftpOpen(Host,userid,pswd,AccntId,1)
   if !IsNumber(ID_ftp) then Display(5, "FTP Open Error",ID_ftp)
   
Return 


Article ID:   W14810
File Created: 2001:11:08:12:40:06
Last Updated: 2001:11:08:12:40:06