?
Solved

Download full directory with tnmftp

Posted on 2000-05-12
2
Medium Priority
?
453 Views
Last Modified: 2007-10-18
I need to download all files from a specific directory onto my local machine.  I am using tnmftp's download function but is there a way to tell it to download all files from a directory?
0
Comment
Question by:brettawv
[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
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
Probie earned 200 total points
ID: 2804938
Drop an NMFTP component on the main form and make sure you have entered
the correct FTP, port and login properties.

There is no disconnection in the code below so if you want to disconnect
from the server you have to do this somewhere yourself.

Add the code below to your project
----


function FixPath(path : string) : string;
begin
 if IsPathDelimiter(Path,length(path)) then result := copy(path,1,length(path)-1) else result := path;
end;

function AttrDirectory(str : string) : boolean;
begin
 str := trim(str);
 result := (upcase(str[1]) = 'D');
end;

procedure TForm1.GetAllFiles(remotedir, localdir : string);
var lp0 : integer;
    localfile : string;
begin
 if NMFTP1.connected = false then NMFTP1.connect;
  if NMFTP1.connected then begin
   if DirectoryExists(FixPath(localdir)) then begin
    NMFTP1.ChangeDir(remotedir);
    NMFTP1.ParseList := true;
    NMFTP1.List;
    for lp0 := 0 to NMFTP1.FTPDirectoryList.name.Count-1 do begin
     if not AttrDirectory(NMFTP1.FTPDirectoryList.Attribute.Strings[lp0]) then begin
      LocalFile := FixPath(localdir)+'\'+NMFTP1.FTPDirectoryList.name.Strings[lp0];
      FFtp.Download(NMFTP1.FTPDirectoryList.name.Strings[lp0],LocalFile);
     end;
    end:
   end;
  end;
 end;
end;
0
 
LVL 1

Expert Comment

by:Probie
ID: 2804950
oppss...
I forgot to change the name in the download loop...

The name should be NMFTP1 not Fftp like in the example...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

770 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