Obtaining file details via FTP

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
GoneToSail
Posts: 30
Joined: Sun Jan 24, 2010 10:34 pm

Obtaining file details via FTP

Post by GoneToSail » Fri May 25, 2012 6:06 pm

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 ?

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2589
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Obtaining file details via FTP

Post by mwieder » Fri May 25, 2012 7:49 pm

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

GoneToSail
Posts: 30
Joined: Sun Jan 24, 2010 10:34 pm

Re: Obtaining file details via FTP

Post by GoneToSail » Fri May 25, 2012 10:42 pm

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 !…

MaxV
Posts: 1362
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Obtaining file details via FTP

Post by MaxV » Thu Mar 02, 2017 2:23 pm

No solutions?
Should I post a bug report?
Livecode Wiki: http://livecode.wikia.com
My blog: http://livecodeitalia.blogspot.it
To post code use this: http://tinyurl.com/ogp6d5w

shaosean
Posts: 878
Joined: Thu Nov 04, 2010 7:53 am

Re: Obtaining file details via FTP

Post by shaosean » Thu Mar 02, 2017 2:38 pm

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

AxWald
Posts: 291
Joined: Thu Mar 06, 2014 2:57 pm

Re: Obtaining file details via FTP

Post by AxWald » Thu Mar 02, 2017 6:53 pm

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!
Livecode programming until the cat hits the fan ...

Post Reply

Return to “Internet”