Obtaining file details via FTP
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 40
- Joined: Sun Jan 24, 2010 10:34 pm
- Location: French Atlantic Island
Obtaining file details via FTP
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 ?
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 ?
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Obtaining file details via FTP
Give this a try:
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
Code: Select all
get liburlftpcommand("ls","ftp.myHostName/DirectoryName","myUserID","myPass")
http://forums.runrev.com/viewtopic.php? ... ftp#p52783
-
- Posts: 40
- Joined: Sun Jan 24, 2010 10:34 pm
- Location: French Atlantic Island
Re: Obtaining file details via FTP
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 !…
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
No solutions?
Should I post a bug report?
Should I post a bug report?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Obtaining file details via FTP
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
https://livecode.com/resources/api/#liv ... istcommand
Re: Obtaining file details via FTP
Hi,
this usually works for me:
You may want to urlEncode myPas before.
Have fun!
this usually works for me:
Code: Select all
put "ftp://" & myUSR & ":" & myPAS \
& "@" & myDir into myURL
libURLSetFTPListCommand "LIST"
put URL myURL into myVar
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!