vitl,
как-то так
Код:
![Выделить весь код](images/misc/selectcode.png)
[Setup]
DefaultDirName={code:Path}
DisableDirPage=True
Uninstallable=false
[Files]
Source: filenull; DestDir: {tmp}; BeforeInstall: BackUp; Flags: ignoreversion
Source: \Settings\Client\; DestDir: {app}\Settings\Client\; BeforeInstall: ChangeCaption('\Settings\Client\'); Flags: ignoreversion recursesubdirs createallsubdirs
Source: \utils\; DestDir: {app}\utils\; BeforeInstall: ChangeCaption('\utils\'); Flags: ignoreversion recursesubdirs createallsubdirs
[*Code]
var DriveLetter : char;
procedure ChangeCaption(str: string);
begin
WizardForm.StatusLabel.Caption:= str;
end;
Function InitializeSetup: Boolean;
var i : Integer;
begin
DriveLetter := ''; i:= Ord('a');
while ( (Length(DriveLetter)=0) or (i<=Ord('z')) )
do begin
if FileExists(Chr(i)+':\markerfile') then DriveLetter := Chr(i);
i := i +1;
end;
if (Length(DriveLetter) > 0 then Result := True
else begin
MsgBox('флэшка не найдена', mbError, mb_Ok);
Result := False;
end;
end;
function Path(): String;
begin
if (Length(DriveLetter) > 0) then Result := DriveLetter +':\' else Result := ExpandConstant('{tmp}');
end;
procedure copyfiles(fromfile, tofile:string);
var res : integer;
begin
Exec('cmd.exe', ' /c copy /Y ' + AddQuotes(fromfile) + ' ' + AddQuotes(tofile),ExpandConstant('{sys}'), SW_Hide,ewWaitUntilTerminated,res);
end;
Procedure backUp();
begin
ChangeCaption('BackUp')
If DirExists (DriveLetter +':\'+'Settings\Client\') then copyfiles(DriveLetter +':\'+'Settings\Client\', DriveLetter +':\'+'Backup\'+GetDateTimeString('YYYYMMDD_hh:nn:ss', '-', '-')+'\Settings\Client\');
if DirExists (DriveLetter +':\'+'utils\') then copyfiles(DriveLetter +':\'+'utils\', DriveLetter +':\'+'Backup\'+GetDateTimeString('YYYYMMDD_hh:nn:ss', '-', '-')+'\utils\');
end;
код идейно верный но могут быть синтаксические ошибки: end'а не хватает, ошибка в названии и тп