Re: [fpc-pascal] Getting strange FTP error using Indy 10 idFTP
On Thu, 23 Nov 2017 10:13:14 +0100, Bo Berglundwrote: >On Thu, 23 Nov 2017 00:09:36 +0100, Bo Berglund > wrote: > >>I need to get a list of the files that match a specific format like: >>_.zip >>I could of course traverse the supplied TStrings and look at the first >>char (discard all d entries) and check if the last part is .zip. >>But it would be a lot easier if the list could be limited to the >>filenames only. > >In fact the windows7 command line ftp client can do this: > >ftp> ls CVS*.zip >200 PORT command successful. >150 Opening ASCII mode data connection for file list. >CVS_Config_2017-09-28.zip >226 Transfer complete. > >Is there a corresponding way for IdFTP to perform a wildcard list and >returning just the matching files? For completeness: - I received help on the Embarcadero forum which is back on-line, and the following command does what I need: FTP.List('CVS*.zip', false); The first argument is a file name specifier string including wildcard * and the second is a flag to supply full information (true) or only the file names (false). With this in place my utility works and the code is now much cleaner. -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Getting strange FTP error using Indy 10 idFTP
On Thu, 23 Nov 2017 00:09:36 +0100, Bo Berglundwrote: >I need to get a list of the files that match a specific format like: >_.zip >I could of course traverse the supplied TStrings and look at the first >char (discard all d entries) and check if the last part is .zip. >But it would be a lot easier if the list could be limited to the >filenames only. In fact the windows7 command line ftp client can do this: ftp> ls CVS*.zip 200 PORT command successful. 150 Opening ASCII mode data connection for file list. CVS_Config_2017-09-28.zip 226 Transfer complete. Is there a corresponding way for IdFTP to perform a wildcard list and returning just the matching files? -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Getting strange FTP error using Indy 10 idFTP
On Wed, 22 Nov 2017 14:11:08 -0600, Zoë Petersonwrote: >On 11/22/2017 1:50 PM, Bo Berglund wrote: >> 20:14:01.018 EXCEPTION: Invalid PORT Command. > >Set FTP.Passive := True. PORT is used for active connections, where the >server opens a connection to the client computer for the data stream. >PASV is used for passive connections, where the client opens a second >connection to the server. > >https://stackoverflow.com/questions/1699145/what-is-the-difference-between-active-and-passive-ftp#1699163 Thanks! That did the trick! I was looking down the Windows Firewall settings to see if something there blocked the communications... It turned out that the old code *had* an FTP.Passive := true; statement hidden away where I did not notice.. And my code for retrieving the list was also incorrect, I needed FTP.Listresult for that. Question: - The result off of this Windows server looks very much like a Linux ls -l command result: -rwxrwxrwx 1 ownergroup1572 Sep 28 15:30 Config_2017-09-28.zip drwxrwxrwx 1 ownergroup 0 Nov 13 19:30 AGIENG drwxrwxrwx 1 ownergroup 0 Nov 22 1:05 CVSREPOS drwxrwxrwx 1 ownergroup 0 Nov 11 15:44 FULLREPO Is this how it always looks like or is there a way to format the list into something less Linux-ish? I need to get a list of the files that match a specific format like: _.zip I could of course traverse the supplied TStrings and look at the first char (discard all d entries) and check if the last part is .zip. But it would be a lot easier if the list could be limited to the filenames only. The FTP.List() command has a number of overloaded versions and I have yet to find a working documentation of these. So in the absence of Remy Lebeau I am hard pressed to figure it out. And tracing down the Indy sources is not an easy task. Maybe one of them will produce a simple file list only? -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Getting strange FTP error using Indy 10 idFTP
On 11/22/2017 1:50 PM, Bo Berglund wrote: 20:14:01.018 EXCEPTION: Invalid PORT Command. Set FTP.Passive := True. PORT is used for active connections, where the server opens a connection to the client computer for the data stream. PASV is used for passive connections, where the client opens a second connection to the server. https://stackoverflow.com/questions/1699145/what-is-the-difference-between-active-and-passive-ftp#1699163 -- Zoë Peterson Scooter Software ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal