Solved

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

Posted on 2006-06-15
3
359 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
  • 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 125 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 improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now