Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to Put NMFTP DirectoryList Items Inside a LIStView Control

Posted on 2002-07-02
8
Medium Priority
?
1,059 Views
Last Modified: 2012-05-04
Hi there,

How can I put the values of NMFTP Directory List inside a Listview Control?

I Was able to put NMFTP Directory List Values in a listbox but the thing is, I have to parse it to get specific information like, date, attributes, size, filename, etc.

I kNow NMFTP Directory list passes the values as a string parameter when the List Method is invoked but how do you get the attribute, name, size, etc from the string parameter?

I tried testing this to get the attribute of a certain file on the list but:

showmessage(NMFTP1.FtpDirectOryList.Attribute.Text);

but it returns a blank box.

Any help would be greatly appreciated.
0
Comment
Question by:lapuk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 7

Expert Comment

by:Cynna
ID: 7125050
lapuk,

> showmessage(NMFTP1.FtpDirectOryList.Attribute.Text);

should be:

showmessage(NMFTP1.FTPDirectoryList.Attribute.Strings[index]);

(for example, index=0, will get you attribute string of first file)

Few remarks:

1. Using List method does not guarantee you to parse atribute, name, size... correctly. This depends on directory listings formatting of the FTP server you are connecting to. If this happens, probably the best would be setting ParseList to false and then using the OnListItem event to do your own manual parsing.

2. NM... (NetMasters) components are known to be quite buggy. I'd advise you to forget them all together, and use third party components (like ICS or Indy).
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7125647
> 1. Using List method does not guarantee you to parse atribute, name, size... correctly.  
that's so true !! in fact in my testing it didn't parse a single site correctly !!!

as Cynna I suggest you to use Indy from www.nevrona.com/indy
0
 

Author Comment

by:lapuk
ID: 7125875
I tried this :
showmessage(NMFTP1.FTPDirectoryList.Attribute.Strings[index]);

but it gives me an out of bounds error, I just wonder why when in fact it was able to list the values inside a listbox..
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Accepted Solution

by:
Cynna earned 200 total points
ID: 7126494
lapuk,

Here's comlete example that works (most of the time: read my remark #2 in previous post, and then read it again).
Initially Copy/Paste it, to see if it works for your local/remote system:

(place Button and NMFTP on the form)

procedure TForm1.Button1Click(Sender: TObject);
var i: Integer;
begin
  NMFTP1.ParseList := True;
  NMFTP1.Vendor := NMOS_AUTO;
  NMFTP1.Connect;
  while not NMFTP1.Connected do begin
     Application.ProcessMessages;
     Sleep(1);
  end;
  Memo1.Lines.Clear;
  Memo1.Lines.Add('Connected');
  NMFTP1.List;
  for i := 0 to NMFTP1.FTPDirectoryList.Name.Count - 1 do
      Memo1.Lines.Add(Format('File: %s, Size: %s, Date: %s, Attr: %s', [
                     NMFTP1.FTPDirectoryList.Name[i],
                     NMFTP1.FTPDirectoryList.Size[i],
                     NMFTP1.FTPDirectoryList.ModifDate[i],
                     NMFTP1.FTPDirectoryList.Attribute[i]]));
  NMFTP1.Disconnect;
end;
0
 

Expert Comment

by:CleanupPing
ID: 9343119
lapuk:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 

Author Comment

by:lapuk
ID: 9345235
Hi sorry all, it took me quite a while to respond to this, thanks to everyone who excerted the effort in finding a solution to my problem. Although this question has been raised a long time ago, and fortunately, I found my own way of solving it.

My solution is almost the same as that of Cynna, although a used Tstringlist instead. My FTP server returns a directory list but all attributes are in a single line, so I have to make a parseing routine to be able to assign specific attributes for each record.

So I am accepting Cynnas Answer instead. :-)

Thanks everyone.
0
 

Author Comment

by:lapuk
ID: 9345251
Hmm.. weird.. I am trying to accept cynnas answer but it gives me this message..

 " You cannot accept this answer.. " hmnn.. kinda weird.
0
 

Author Comment

by:lapuk
ID: 9345256
oh.. ok.. now its updated :-)

Thanks all!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question