Page 1 of 1

Obtaining file details via FTP

Posted: Fri May 25, 2012 6:06 pm
by GoneToSail
Good afternoon,
I'm trying to get the date and time when a text file was updated in a given directory located on a remote server.
I read all of a previous post titled "Help ! Unable to acquire FTP file list!" dated March 1st, 2012, as I thought that the question raised was very similar to mine, but I am not familiar enough with the ftp commands.
I thought that the following line would do the job:
get libURLftpCommand("LIST","ftp.myHostName/DirectoryName","myUserID","myPass")
but I was only able to get a message: "425 Unable to build data connection: Invalid argument".
Would anyone know how to do this ?

Re: Obtaining file details via FTP

Posted: Fri May 25, 2012 7:49 pm
by mwieder
Give this a try:

Code: Select all

get liburlftpcommand("ls","ftp.myHostName/DirectoryName","myUserID","myPass")
The "LIST" ftp command is a bit of a problem, as it requires setting up a secondary port. See

http://forums.runrev.com/viewtopic.php? ... ftp#p52783

Re: Obtaining file details via FTP

Posted: Fri May 25, 2012 10:42 pm
by GoneToSail
Thank you for your comment.
Actually, the link that you indicate is the post that I have already quoted in my previous message (titled: "Help ! Unable to acquire FTP file list") . And although I read it carefully several times (and may be because english is not my mother language), I could not find the keys to how to obtain the file update date and time that I need !
The "ls" command in liburlftpcommand only gives me the following reply: "500 LS not understood"
Well, I'm still stuck !…

Re: Obtaining file details via FTP

Posted: Thu Mar 02, 2017 2:23 pm
by MaxV
No solutions?
Should I post a bug report?

Re: Obtaining file details via FTP

Posted: Thu Mar 02, 2017 2:38 pm
by shaosean
LIST is the only command that is guaranteed to work on all FTP servers.. You are getting the error about no open data port because you need to connect to the server, using another port, to receive the file listing.. I believe the liburlsetftplistcommand does everything for you, but I never used the built-in FTP as there are limitations with it..

https://livecode.com/resources/api/#liv ... istcommand

Re: Obtaining file details via FTP

Posted: Thu Mar 02, 2017 6:53 pm
by AxWald
Hi,

this usually works for me:

Code: Select all

    put "ftp://" & myUSR & ":" & myPAS \
             & "@" & myDir into myURL
       libURLSetFTPListCommand "LIST"
       put URL myURL into myVar
You may want to urlEncode myPas before.

Have fun!