Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) FTP Iterate over Files in Directory Matching ListPatternSee more RSA ExamplesUses the ListPattern property to iterate over the files in a directory matching the pattern.
; This example requires the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. $oFtp = ObjCreate("Chilkat.Ftp2") $oFtp.Hostname = "ftp.example.com" $oFtp.Username = "my_login" $oFtp.Password = "my_password" $oFtp.Port = 21 $oFtp.AuthTls = True Local $bSuccess = $oFtp.Connect() If ($bSuccess <> True) Then ConsoleWrite($oFtp.LastErrorText & @CRLF) Exit EndIf ; Change to the "images" sub-directory located under our FTP account's home directory. $bSuccess = $oFtp.ChangeRemoteDir("images") If ($bSuccess <> True) Then ConsoleWrite($oFtp.LastErrorText & @CRLF) Exit EndIf $oFtp.ListPattern = "*.png" ; Fetch the current remote directory contents by calling GetDirCount Local $iN = $oFtp.GetDirCount() If ($iN < 0) Then ConsoleWrite($oFtp.LastErrorText & @CRLF) Exit EndIf Local $i = 0 Local $sFilename $oSbLocalPath = ObjCreate("Chilkat.StringBuilder") While $i < $iN $sFilename = $oFtp.GetFilename($i) ConsoleWrite($sFilename & @CRLF) ; Download this file. $oSbLocalPath.SetString("qa_output/") $oSbLocalPath.Append($sFilename) $bSuccess = $oFtp.GetFile($sFilename,$oSbLocalPath.GetAsString()) If ($bSuccess <> True) Then ConsoleWrite($oFtp.LastErrorText & @CRLF) Exit EndIf $i = $i + 1 Wend |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.