Jump to content
Guest

Delete, Rename file functions with ICS FtpClient

Recommended Posts

Guest

Hello everybody,

I use ICS component with delphi 7 uploading files no problems. I need to know please how to delete and rename files with FtpClient I didn't found in the ftp sample

Thanks !

Share this post


Link to post

Simple check (FileExists()) before download from your list, delete or rename however you like (depending on filesize, I would first download and on success rename to the original filename)

Share this post


Link to post
2 hours ago, Brahim said:

I need to know please how to delete and rename files with FtpClient I didn't found in the ftp sample

If you are trying to delete/rename remote files on the FTP server, TFtpClient has methods for that purpose:

Quote

Ren        - Rename a file or directory on the server from HostFileName to LocalFileName
Rename     - Connect, Cwd, Rename a file or directory on the server & Quit

 

Dele       - Delete a file on the server in HostFileName
Delete     - Connect, Cwd, Delete a file on the server & Quit

 

Share this post


Link to post

The old SSL FTP sample has buttons named Delete and Rename which send the FTP command to delete and rename files on an FTP server. 

 

But you should really look at the OverbyteIcsXferTst sample which uses more modern techniques so you don't need to worry about sending individual commands, you can ask it to sync a local and remote directory and it will delete old files while copying new or changed files 

 

Angus

 

 

Share this post


Link to post
Guest
27 minutes ago, Remy Lebeau said:

If you are trying to delete/rename remote files on the FTP server, TFtpClient has methods for that purpose:

 

Yes the operation must be executed on the ftp server
I didn't know how to use  HostFileName to LocalFileName for renaming

Thanks Remy Lebeau

if I understand
HostFileName :=picture1.jpg (stored in server)
LocalFileName :=picture2.jpg

picture1.jpg must be renamed to picture2.jpg  is it right ?

 

34 minutes ago, Angus Robertson said:

But you should really look at the OverbyteIcsXferTst sample which uses more modern techniques

 

I will the sample thanks Angus

(sorry for my english)

Quote

 

 

 

Share this post


Link to post
Guest

Just another question :
what is the difference between Rename and RenameAsync ?

Thank you

Edited by Guest

Share this post


Link to post
Guest

OK for the question Angus has explained it. The first time I didn't undestand

Edited by Guest
orthography error

Share this post


Link to post
23 hours ago, Brahim said:

if I understand
HostFileName :=picture1.jpg (stored in server)
LocalFileName :=picture2.jpg

picture1.jpg must be renamed to picture2.jpg  is it right ?

Yes.

Share this post


Link to post
Guest

It's solved
I tried Delete and Rename methods successfully
Thank you Remy

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×