Japster
Japster

Reputation: 1003

How do I delete a file?

I need to delete a picture from a folder where pictures are stored. For example, a file in the C:\Milk\Pictures folder. How do I do this?

Upvotes: 4

Views: 11950

Answers (1)

Ken White
Ken White

Reputation: 125757

Using the SysUtils function DeleteFile:

if DeleteFile(FileName) then
  // File deleted;

SysUtils is usually included by default. In XE2, if you have to add it you may have to use System.SysUtils because of new namespace rules.

Upvotes: 9

Related Questions