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

x
?
Solved

Looking for a Code to download file(s) from FTP server and delete.

Posted on 2006-06-15
3
Medium Priority
?
369 Views
Last Modified: 2007-10-18
Hi Experts

I am looking for a script to work on Windows wich will download file(s) from a server using indy ftp and than delete the file(s) after downloading.

Waiting for a quick response..

Thanks
0
Comment
Question by:royalcyber
[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
3 Comments
 
LVL 10

Expert Comment

by:atul_parmar
ID: 16918228
var
  s : TFileStream;
  Host, UserName, Password, FTPFileName, LocalFileName : String;
begin
  IdFTP1.Host := Host;
  IdFTP1.Username := UserName;
  IdFTP1.Password := Password;
  s := TFileStream.Create(LocalFileName, fmOpenWrite);
  IdFTP1.Get(FTPFileName, s);
  IdFTP1.Delete(FTPFileName);
  IdFTP1.Disconnect;
  s.Free;
end;
0
 
LVL 10

Accepted Solution

by:
atul_parmar earned 500 total points
ID: 16918236
var
  s : TFileStream;
  Host, UserName, Password, FTPFileName, LocalFileName : String;
begin
  IdFTP1.Host := Host;
  IdFTP1.Username := UserName;
  IdFTP1.Password := Password;
  s := TFileStream.Create(LocalFileName, fmOpenWrite);
  IdFTP1.Connect; >>>>>>>>>>>> This line was missed
  IdFTP1.Get(FTPFileName, s);
  IdFTP1.Delete(FTPFileName);
  IdFTP1.Disconnect;
  s.Free;
end;
0
 

Author Comment

by:royalcyber
ID: 16966531


Thanks atul, it worked good.

Regards
Azhar
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

596 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