1. this is the code I made before for an old application:
procedure TfrmBackup.tblInput_PATHValidate(Sender: TField);
begin
if tblInput_PATH.Value = '' then Exit;
if not DirectoryExists(tblInput_PATH.Value) then
raise Exception.Create('Directory does not exist.');
end;
procedure TfrmBackup.bbnOKClick(Sender: TObject);
var
sTables : TStringList;
i : integer;
sCurrentPath : string;
begin
sCurrentPath := sGetDBPath(frmumenu.DBEWS);
try
sTables := TStringList.Create;
if tblInput_DATABASE.Value = '' then
begin
AFDMessageDlg('DataSet name must be entered.', mtError, [mbOK], 0);
dbeDatabase.SetFocus;
Exit;
end;
if tblInput_PATH.Value = '' then
begin
AFDMessageDlg('Path must be entered.', mtError, [mbOK], 0);
dbePath.SetFocus;
Exit;
end;
Session.AddStandardAlias(Uppercase(tblInput_DATABASE.Value), tblInput_PATH.Value, 'DBASE');
Session.SaveConfigFile;
Session.GetTableNames(frmuMenu.DBEWS.DatabaseName, '*.dbf', False, False, sTables);
ShowWorking('Backup Files', sTables.Count);
for i := 0 to sTables.Count - 1 do
begin
CopyFile(PChar(sCurrentPath + sTables + '.dbf'), PChar(tblInput_PATH.Value + '/' + sTables + '.dbf'), False);
CopyFile(PChar(sCurrentPath + sTables + '.mdx'), PChar(tblInput_PATH.Value + '/' + sTables + '.mdx'), False);
UpdateWorking(i+1);
end;
finally
sTables.Free;
WorkingEnd;
end;
Close;
end;
2. use 'findfirst' and 'findnext' or copyfolder(ISAPI)