'폴더'에 해당되는 글 2건

  1. 2012.10.23 폴더 복사,이동,삭제
  2. 2012.10.23 부모풀더까지 한방에 만들기
 
uses
  ShellApi;

function CopyDir(const fromDir, toDir: string): Boolean;
var
  fos: TSHFileOpStruct;
begin
  ZeroMemory(@fos, SizeOf(fos));
  with fos do
  begin
    wFunc  := FO_COPY;
    fFlags := FOF_FILESONLY;
    pFrom  := PChar(fromDir + #0);
    pTo    := PChar(toDir)
  end;
  Result := (0 = ShFileOperation(fos));
end;


function MoveDir(const fromDir, toDir: string): Boolean;
var
  fos: TSHFileOpStruct;
begin
  ZeroMemory(@fos, SizeOf(fos));
  with fos do
  begin
    wFunc  := FO_MOVE;
    fFlags := FOF_FILESONLY;
    pFrom  := PChar(fromDir + #0);
    pTo    := PChar(toDir)
  end;
  Result := (0 = ShFileOperation(fos));
end;

function DelDir(dir: string): Boolean;
var
  fos: TSHFileOpStruct;
begin
  ZeroMemory(@fos, SizeOf(fos));
  with fos do
  begin
    wFunc  := FO_DELETE;
    fFlags := FOF_SILENT or FOF_NOCONFIRMATION;
    pFrom  := PChar(dir + #0);
  end;
  Result := (0 = ShFileOperation(fos));
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
  if cCopyDir('d:\download', 'e:\') = True then
    ShowMessage('Directory copied.');
end;


'APP > 파일관련' 카테고리의 다른 글

SelectDirectory 확장  (0) 2012.10.23
SelectDirectory 원하는 위치에 띄우기  (0) 2012.10.23
파일 버전 구하기  (0) 2012.10.23
부모풀더까지 한방에 만들기  (0) 2012.10.23
Posted by ezmind
:
 

if ForceDirectories('C:\myFolder\sub1\sub2') then Caption := 'C:\myFolder\sub1\sub2 생성 완료';

'APP > 파일관련' 카테고리의 다른 글

SelectDirectory 확장  (0) 2012.10.23
SelectDirectory 원하는 위치에 띄우기  (0) 2012.10.23
폴더 복사,이동,삭제  (0) 2012.10.23
파일 버전 구하기  (0) 2012.10.23
Posted by ezmind
: