unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ShellCtrls, ExtCtrls, SkinCaption,
WinSkinData, Buttons;
type
TForm1 = class(TForm)
ShellTreeView1: TShellTreeView;
Bevel1: TBevel;
SkinData1: TSkinData;
SkinCaption1: TSkinCaption;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.Caption:='Abrir carpeta';
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var PathDestino, Origen, aPath, Destino, my_mensaje : string;
sr: TSearchRec;begin
my_mensaje:='Y se han guardado en la siguiente ubicación.'+#13;
PathDestino := ShellTreeView1.SelectedFolder.PathName+'\[ Respaldo Caro me ayudo ]'; if not DirectoryExists(PathDestino) then begin
aPath := 'C:\sistema_caja\base de datos\'; if FindFirst(aPath + '*.db', faAnyFile, sr) = 0 Then repeat
CreateDir(PathDestino); Origen := aPath+sr.Name; Destino := PathDestino+'\'+ sr.Name; CopyFile(PChar(Origen), PChar(Destino), False); until FindNext(sr) <> 0; SysUtils.FindClose(sr); Application.MessageBox('Las bases de datos se han respaldado ! ! ! ','Información',MB_ICONINFORMATION);
MessageDlg( my_mensaje + ShellTreeView1.SelectedFolder.PathName + '\[ Respaldo Caro me ayudo ]',mtInformation,[mbOK],0);
end
else
begin
Application.MessageBox('Uuuuuy hijo la carpeta ya existe.','Orrorsote',MB_ICONERROR);
Application.MessageBox('Suerte para la proxima! ! !','Suerte',MB_ICONINFORMATION);
end;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
var PathDestino, Origen, aPath, Destino, my_mensaje : string;
sr: TSearchRec;begin
my_mensaje:='Y se han guardado en la siguiente ubicación.'+#13;
PathDestino := ShellTreeView1.SelectedFolder.PathName+'\[ Respaldo Caro me ayudo ]'; if not DirectoryExists(PathDestino) then begin
aPath := 'C:\sistema_caja\base de datos\'; if FindFirst(aPath + '*.db', faAnyFile, sr) = 0 Then begin
while FindNext(sr) = 0 do begin
CreateDir(PathDestino); Origen := aPath+sr.Name; Destino := PathDestino+'\'+ sr.Name; CopyFile(PChar(Origen), PChar(Destino), False); end;
Application.MessageBox('Las bases de datos se han respaldado ! ! ! ','Información',MB_ICONINFORMATION);
MessageDlg( my_mensaje + ShellTreeView1.SelectedFolder.PathName + '\[ Respaldo Caro me ayudo ]',mtInformation,[mbOK],0);
SysUtils.FindClose(sr); end;
end
else
begin
Application.MessageBox('Uuuuuy hijo la carpeta ya existe.','Orrorsote',MB_ICONERROR);
Application.MessageBox('Suerte para la proxima! ! !','Suerte',MB_ICONINFORMATION);
end;
end;
end.