Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ftp.Dir with subfolders
#7
I created:

Member function Ftp.Dir2
Code:
Copy      Help
function$ [$_file] [flags] [WIN32_FIND_DATA&info] ;;flags: 0 file, 1 folder, 2 both, 3 previous. ;;usa flaps INTERNET_FLAG_NO_CACHE_WRITE|INTERNET_FLAG_RELOAD

;Finds or enumerates files in FTP server.
;Returns found filename.
;This function is similar to <help "::/Functions/IDP_DIR.html">dir</help>.
;_file can contain wildcard characters. Cannot contain spaces.
;If _file not used or is "", finds next matching file.
;Member variable m_fd.fd contains more information about file. If info is not 0, copies m_fd.fd to info.

;Note: This function does not support Unicode.


if(!m_fd) m_fd._new
if(getopt(nargs)=0 or flags&3=3) flags=m_fd.flags; else m_fd.flags=flags

if(!empty(_file)) ;;find first file
,if(m_fd.hfind) InternetCloseHandle(m_fd.hfind)
,m_fd.hfind=FtpFindFirstFile(m_hi _file &m_fd.fd INTERNET_FLAG_NO_CACHE_WRITE|INTERNET_FLAG_RELOAD 0)
,if(!m_fd.hfind) ret
,;filter
,int isdir=m_fd.fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY
,sel(flags)
,,case 0: if(isdir) goto next ;;must be file
,,case 1: if(!isdir) goto next ;;must be folder
,if(&info) info=m_fd.fd
,ret &m_fd.fd.cFileName ;;and leave open handle for enumeration
else ;;find next file
,if(!m_fd.hfind) ret
,;next
,if(InternetFindNextFile(m_fd.hfind &m_fd.fd)) goto filter
,;nomore
,InternetCloseHandle(m_fd.hfind); m_fd.hfind=0

and works.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)