Delete,Rename Files en delphi

as I can delete and rename files?

jara_vlaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

edeyCommented:
try these:

Unit

SysUtils
DeleteFile deletes a file from disk, and returns False if the delete fails.

function DeleteFile(const FileName: string): Boolean;

Description

The DeleteFile function erases the file named by FileName from the disk. If the file cannot be deleted or does not exist, the function returns False.

Example

The following code erases the file DELETE.ME in the current directory:

DeleteFile('DELETE.ME');

and:


Unit

SysUtils

Category

File Management Routines
RenameFile changes a file name identified by OldName.

function RenameFile(const OldName, NewName: string): Boolean;

Description

The RenameFile function attempts to change the name of the file specified by OldFile to NewFile. If the operation succeeds, RenameFile returns True. If it cannot rename the file (for example, if a file called NewName already exists), it returns False.

Example

The following code renames a file:

if not RenameFile('OLDNAME.TXT','NEWNAME.TXT') then

  ErrorMsg('Error renaming file!');

this was also taken from the help file:

procedure TFMForm.ConfirmChange(const ACaption, FromFile, ToFile: string);
begin
  if MessageDlg(Format('%s %s to %s?', [ACaption, FromFile, ToFile]),
    mtConfirmation, [mbYes, mbNo], 0) = mrYes then
 begin
    if ACaption = 'Move' then
      MoveFile(FromFile, ToFile)
   else if ACaption = 'Copy' then
      CopyFile(FromFile, ToFile)
   else if ACaption = 'Rename' then
      RenameFile(FromFile, ToFile);

   FileList.Update;
  end;
end;


GL
Mike
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jara_vlaAuthor Commented:
very thanks!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.