?
Solved

idFTP Upload Loop Needed

Posted on 2007-10-12
1
Medium Priority
?
571 Views
Last Modified: 2012-08-13
Hi all,

On my host I've got a bunch of folders with have the same name as filenames stored in my pc.
I need to update these files via idFTP to the server and save them in there own folders one at a time.

The Folder names and filenames match, so for example:

Filename: AAEESS.csv with be uploaded into the AAEESS Folder
                AADDEE.csv with be uploaded into the AADDEE Folder

Etc...

Hope you can help!

Thanks

ST3VO


0
Comment
Question by:ST3VO
1 Comment
 
LVL 28

Accepted Solution

by:
2266180 earned 2000 total points
ID: 20065064
well, you write a function that uploads one of those files and then you call it for every file (you do a findfirst/findnext)

something like this:

procedure tform1.uploadfile(filename:string);
var dir:string;
begin
  dir:=extractfilename(filename);
  while dir[length(dir)]<>'.' do
    delete(dir, length(dir), 1);
  delete(dir, length(dir), 1);
  idftp1.ChangeDir(dir);
  idftp1.put(filename);
  idftp1.ChangeDirUp;
end;

procedure tform1.uploadfrom(dirfrom, dirto:string);
var r:tsearchrec;
begin
  idftp1.ChangeDir(dirto);
  dirfrom:=IncludeTrailingPathDelimiter(dirfrom);
  if findfirst(dirfrom+'*.csv', faanyfile-fadirectory, r)=0 then
    repeat
      uploadfile(dirfrom+r.name);
    until findnext(r)<>0;
end;
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…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview
Suggested Courses

807 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