Guest Posted February 14, 2023 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
KodeZwerg 54 Posted February 14, 2023 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
Remy Lebeau 1398 Posted February 14, 2023 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
Angus Robertson 574 Posted February 14, 2023 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 Posted February 14, 2023 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 Posted February 14, 2023 (edited) Just another question : what is the difference between Rename and RenameAsync ? Thank you Edited February 14, 2023 by Guest Share this post Link to post
Guest Posted February 14, 2023 (edited) OK for the question Angus has explained it. The first time I didn't undestand Edited February 14, 2023 by Guest orthography error Share this post Link to post
Remy Lebeau 1398 Posted February 15, 2023 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 Posted February 15, 2023 It's solved I tried Delete and Rename methods successfully Thank you Remy Share this post Link to post