Jump to content
Sign in to follow this  
mary

FTP FindFile

Recommended Posts

mary

Hi !

Just a question about how to do a FileSearch("FTP.server.com", *.cfg) ?

thanks a lot

Share this post


Link to post
Share on other sites
Yashied

#Include <FTP.au3>

Global Const $Host = 'ftp.mozilla.org'
Global Const $Login = ''
Global Const $Password = ''

Global $hFtp, $hSession, $hFind, $tFind, $sFile

_FTP_Startup()

$hFtp = _FTP_Open('MyFtp')
$hSession = _FTP_Connect($hFtp, $Host, $Login, $Password)

$tFind = DllStructCreate($tagWIN32_FIND_DATA)
$hFind = _FTP_FileFindFirst($hSession, '', $tFind)
While Not @error
    $sFile = DllStructGetData($tFind, 'FileName')
    If StringCompare(StringRegExpReplace($sFile, '^.*\.', ''), 'cfg') = 0 Then
        ConsoleWrite($sFile & @CR)
    EndIf
    _FTP_FileFindNext($hFind, $tFind)
WEnd
_FTP_FileFindClose($hFind)

_FTP_Disconnect($hSession)
_FTP_Close($hFtp)

_FTP_Shutdown()

FTP.au3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.