Source language: Translate to:

FTP LIST command not working.

Questions about our File Management and Internet FTP plug-in

FTP LIST command not working.

Postby DaveJ » Sun Mar 22, 2015 9:31 am

I have tried for days to get the fmSendFTPCommand "FTP" "LIST" "[FTPLIST]" working with both a Western Digital 'My Cloud' and a CentOS7 ftp server setup and neither will return a file list.
If I use Filezilla ftp client or a web browser it all works well with both FTP servers.
If I send a PASV command and then a LIST command the program freezes for a few minutes and then returns an error "Read timed out"
The Neobook FTP Client.pub also suffers the same problem, so now I know it is not my code.
Here is the log.
Code: Select all
Program started               
FTP Import Completed   Connecting to 192.168.1.150.            
Connected.               
<<- 220 Welcome               
->> USER test               
<<- 331 Please specify the password.               
->> PASS **********               
<<- 230 Login successful.               
->> FEAT               
<<- 211-Features:               
<<-  EPRT               
<<-  EPSV               
<<-  MDTM               
<<-  PASV               
<<-  REST STREAM               
<<-  SIZE               
<<-  TVFS               
<<-  UTF8               
<<- 211 End               
->> TYPE A               
<<- 200 Switching to ASCII mode.               
Starting FTP transfer               
->> PASV               
<<- 227 Entering Passive Mode (192   168   1   150   88   45).
->> LIST               
<<- 150 Here comes the directory listing.               
Transfer complete               
<<- 226 Directory send OK.               
->> PWD               
<<- 257 "/home/test"               
->> PWD               
<<- 257 "/home/test"               
->> CWD /               
<<- 250 Directory successfully changed.               
Starting FTP transfer               
->> PASV               
<<- 227 Entering Passive Mode (192   168   1   150   163   47).
->> LIST  -a               
<<- 150 Here comes the directory listing.               
Transfer complete               
<<- 226 Directory send OK.               
->> PWD               
<<- 257 "/"               
->> CWD /               
<<- 250 Directory successfully changed.               
Starting FTP transfer               
->> PASV               
<<- 227 Entering Passive Mode (192   168   1   150   243   54).
->> LIST  -a               
<<- 150 Here comes the directory listing.               
Transfer complete               
<<- 226 Directory send OK.               
->> CWD /               
<<- 250 Directory successfully changed.               
Starting FTP transfer               
->> PASV               
<<- 227 Entering Passive Mode (192   168   1   150   161   173).
->> LIST  -a               
<<- 150 Here comes the directory listing.               
Transfer complete   


Has anyone had the same problem?

Thanks
Dave J
DaveJ
 
Posts: 90
Joined: Tue Dec 30, 2008 11:06 am

Re: FTP LIST command not working.

Postby Neosoft Support » Mon Mar 23, 2015 10:46 am

I'm getting the same error with the LIST command here. It may be that the data returned by the server is not being interpreted correctly by FM/FTP. I'll have to do some research to see if there is a solution.

As a workaround, you can try using the fmFileListToVar action instead which will return a list of files/folders in the current dir.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: FTP LIST command not working.

Postby DaveJ » Mon Mar 23, 2015 5:44 pm

Thanks,
Good to know.
Look forward to a solution.
I will try your suggestion.

Thanks
DaveJ
 
Posts: 90
Joined: Tue Dec 30, 2008 11:06 am

Re: FTP LIST command not working.

Postby DaveJ » Sun Mar 29, 2015 2:08 am

This is getting quite confusing now.
The 'fmFileListToVar' is only returning directory names, as soon as I move to a directory with just files, it returns nothing.
As both my CenstOS system and Western Digital NAS are both Linux based, I have setup a windows server box running IIS with FTP services. This setup returns both files and directories but if I use the following command
fmGetItemInfo "FTP" "Package.zip" "Size" "Plain" "[FTPsize]"
I get a 'file not found'.
If I run this command
fmSendFTPCommand "FTP" "SIZE Package.zip" "FTPsizex"
I get the size back ok.

I am basically trying to create an auto update program. I have created a file called 'package.zip' of which I compare the size on the ftp server to the size locally and if they are different I download the new file. A bit crude but good enough for my purpose. I just dont seem to be able to get many of the commands working.

Any ideas how I can do this?
Thanks
Dave J
DaveJ
 
Posts: 90
Joined: Tue Dec 30, 2008 11:06 am

Re: FTP LIST command not working.

Postby DaveJ » Sun Mar 29, 2015 3:19 am

Just to ensure that I haven't done something silly, I have created a publication with just one button.
Code: Select all
fmConnectRemote "FTP" "192.168.1.8" "User=testaccount;Password=testaccount1#;Port=21;Passive=Yes;Timeout=60;InitialPath=;LogLimit=0;KeepAlive=0"
fmFileListToVar "FTP" "FullPath=No;IncludeFiles=Yes;IncludeFolders=No;SelectedOnly=No" "FTPResult"
fmFileExists "FTP" "Package.zip" "FTPFileExists"
fmSendFTPCommand "FTP" "SIZE Package.zip" "FTPsizex"


The resulting variables are;
Code: Select all
FTP.CurrentDir=/
FTP.FileMask=*.*
FTP.Log=Connecting to 192.168.1.8.
Connected.
<<- 220 Microsoft FTP Service
->> USER testaccount
<<- 331 Password required for testaccount.
->> PASS ***************
<<- 230 User logged in.
->> FEAT
<<- 211-Extended features supported:
<<-  LANG EN*
<<-  UTF8
<<-  AUTH TLS;TLS-C;SSL;TLS-P;
<<-  PBSZ
<<-  PROT C;P;
<<-  CCC
<<-  HOST
<<-  SIZE
<<-  MDTM
<<-  REST STREAM
<<- 211 END
->> TYPE A
<<- 200 Type set to A.
Starting FTP transfer
->> PASV
<<- 227 Entering Passive Mode (192,168,1,8,250,102).
->> LIST
<<- 125 Data connection already open; Transfer starting.
Transfer complete
<<- 226 Transfer complete.
->> PWD
<<- 257 "/" is current directory.
->> PWD
<<- 257 "/" is current directory.
->> PWD
<<- 257 "/" is current directory.
->> CWD /
<<- 250 CWD command successful.
Starting FTP transfer
->> PASV
<<- 227 Entering Passive Mode (192,168,1,8,250,103).
->> LIST  -a
<<- 125 Data connection already open; Transfer starting.
<<- 226 Transfer complete.
Transfer complete
->> CWD /
<<- 250 CWD command successful.
Starting FTP transfer
->> PASV
<<- 227 Entering Passive Mode (192,168,1,8,250,104).
->> LIST  -a
<<- 125 Data connection already open; Transfer starting.
<<- 226 Transfer complete.
Transfer complete
->> SYST
<<- 215 Windows_NT
->> TYPE A
<<- 200 Type set to A.
Connection established
->> PWD
<<- 257 "/" is current directory.
->> CWD
<<- 250 CWD command successful.
Starting FTP transfer
->> PASV
<<- 227 Entering Passive Mode (192,168,1,8,250,105).
->> LIST  -a
<<- 125 Data connection already open; Transfer starting.
<<- 226 Transfer complete.
Transfer complete
->> SIZE Package.zip
<<- 213 11115152
->> PWD
<<- 257 "/" is current directory.
FTP.Status=Connected
FTP.TotalItems=2
FTPFileExists=False
FTPResult=MD5SUMS;Package.zip
FTPsizex=213
11115152

hpwNBVersion=585.2


As you can see fmFileListToVar lists Package.zip as a file but FMFileExists says it doesn't.
fmSendFTPCommand "FTP" "SIZE Package.zip" "FTPsizex" says it does exist because it can read its size.
DaveJ
 
Posts: 90
Joined: Tue Dec 30, 2008 11:06 am

Re: FTP LIST command not working.

Postby Neosoft Support » Mon Mar 30, 2015 10:49 am

The fmFileExists does work, but you need to include a path along with the file's name. For example:

fmConnectRemote "FTP" ...
fmFileExists "FTP" "/httpdocs/Package.zip" "[FTPFileExists]"

The fmGetItemInfo works the same way. For example, to get the file's size you could do this:

fmConnectRemote "FTP" ...
fmGetItemInfo "FTP" "/httpdocs/Package.zip" "Size" "Plain" "[FTPSize]"

I've used "httpdocs" as the path here, but if your website is organized differently, then you may need to change this.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: FTP LIST command not working.

Postby DaveJ » Mon Mar 30, 2015 2:29 pm

Hi Dave, I have sent an email to you.
My files were located in the root directory so there should have been no need for any further path statement.

Thanks
DaveJ
 
Posts: 90
Joined: Tue Dec 30, 2008 11:06 am

Re: FTP LIST command not working.

Postby Neosoft Support » Tue Mar 31, 2015 10:20 am

Thanks for sending the sample pub file and for providing access to your server for testing. I was able to reproduce the problem you described with the file list. After some research and experimentation, I was able to find a solution. I sent you a file via email to test. Hopefully, it wasn't eaten by your Spam filter.

Currently FM/FTP executes the LIST command with an extra parameter "-a" which is supposed to tell the server to include hidden files
(like .htaccess) in the list of files. This works fine with Unix-based servers, but apparently isn't supported by Windows-based servers like yours. Removing the "-a" seems to have fixed the problem, but you can confirm this with the files I sent.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: FTP LIST command not working.

Postby DaveJ » Tue Mar 31, 2015 11:45 am

Got the files and all looks good.
All the functions seem to be working now.
I will test further.

Many thanks for the quick fix.

Dave J
DaveJ
 
Posts: 90
Joined: Tue Dec 30, 2008 11:06 am

Re: FTP LIST command not working.

Postby Neosoft Support » Wed Apr 01, 2015 4:05 pm

You're welcome. Let us know the final results of your testing.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: FTP LIST command not working.

Postby DaveJ » Mon Apr 06, 2015 1:59 pm

Hi Dave,
Sorry to take so long but I think there still may be some problems.
All is well with the Microsoft FTP server but the Western Digital NAS seems to still have problems (Linux/Unix based).

Code: Select all
fmConnectRemote "FTP" "192.168.1.30" "User=user;Password=password;Port=21;Passive=No;Timeout=60000;InitialPath=data;LogLimit=0;KeepAlive=0"
fmShowFileBrowser "FTP" "Rectangle1"
fmFileListToVar "FTP" "FullPath=Yes;IncludeFiles=Yes;IncludeFolders=Yes;SelectedOnly=No" "FTPResult"
fmFileExists "FTP" "Package.zip" "[FTPFileExists]"
fmGetItemInfo "FTP" "Package.zip" "Size" "Plain" "[FTPSize]"
fmSendFTPCommand "FTP" "SIZE Package.zip" "FTPsizex"


The rectangle is showing the correct files, fmFileListToVar works and the fmSendFTPCommand "FTP" "SIZE Package.zip" works but the fmFileExists reports false and fmGetItemInfo says file not found.
I would be more than happy to set up a test server account if you need it.
Thanks

Dave J
DaveJ
 
Posts: 90
Joined: Tue Dec 30, 2008 11:06 am

Re: FTP LIST command not working.

Postby Neosoft Support » Wed Apr 08, 2015 1:28 pm

I don't know why the Western Digital NAS wouldn't work when other servers do. You would think they would all be compatible, but I guess not. Since we don't have a WD NAS server, I will need to have access to yours in order to troubleshoot. I won't be able to look at this until Friday however.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA


Return to NeoBookFM/FTP

Who is online

Users browsing this forum: No registered users and 1 guest