Показать сообщение отдельно
  #8  
Старый 22.08.2012, 09:49
Danielz Danielz вне форума
Прохожий
 
Регистрация: 21.08.2012
Сообщения: 7
Репутация: 10
По умолчанию

Цитата:
Сообщение от RusMaXXX
ты хоть фрагмент кода показал!!! было бы проще искать ошибку

Код:
function MoveToArc(SourceFile, DestDir: string; Directory: boolean): boolean;
var
  FindFile: TSearchRec;
begin
  Result := True;
  // Создаем папку DestDir
  if not CreateDir(PWideChar(DestDir)) then
    if GetLastError <> 183 then
    begin
      Result := False;
      Exit;
    end;
  if Directory then
  begin
    // Создаем директорию SourceFile в папке DestDir
    if not CreateDir(PWideChar(DestDir + '\' + ExtractFileName(SourceFile))) then
      if GetLastError <> 183 then
      begin
        Result := False;
        Exit;
      end;
    if FindFirst(SourceFile + '\*.*', faanyfile, FindFile) = 0 then
    begin
      repeat
        if FindFile.Attr <> faDirectory then
          if not MoveToArc(SourceFile + '\' + FindFile.Name, DestDir + '\' + ExtractFileName(SourceFile), False) then
          begin
            Result := False;
            Exit;
          end;
      until FindNext(FindFile) <> 0;
      FindClose(FindFile);
      if not RemoveDir(PWideChar(SourceFile)) then
        Result := False;
    end;
  end
  else
  begin
    if CopyFile(PWideChar(SourceFile), PWideChar(DestDir + '\' + ExtractFileName(SourceFile)), True) then
    begin
      if not DeleteFile(SourceFile) then
        Result := False;
    end
    else
      Result := False;
  end;
end;
Ответить с цитированием