How to monitor folder content change in Delphi

It's very simple. Just drop TFolderMonitor component onto your form, create OnChange event handler, set the Folder property and then set Active property to True to activate.

procedure TfrmFoldMonMain.chbActiveClick(Sender: TObject);
begin
  with cmpFolderMonitor do
  begin
    Folder:=edtFolder.Text;
    RecurseSubfolders:=chbRecurseSubfolders.Checked;
    Active:=chbActive.Checked;
  end;
end;

If you need to monitor the target folder with all subfolders, set the RecurseSobfolders property to True.

When something is changed in the target folder (file/subfolder was created/changed/removed) the OnChange event will be fired.

procedure TfrmFoldMonMain.cmpFolderMonitorChange(Sender: TObject);
begin
  with Sender as TFolderMonitor do
    memLog.Lines.Add('Content of "'+Folder+'" was changed at '+DateTimeToStr(Now));
end;
See also
Folder Monitor
Components for Delphi / C++ Builder
Howtos for Programmers