C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[43113] Re:Re:Re:파일과 디렉토리 복사명령은?
. [] 1797 읽음    2005-12-29 01:50
아래와 같이 하면  c:\temp 디렉토리 밑에 있는 모든 파일과 디렉토리들이 recursive하게 c\temp2 디렉토리에 복사됩니다.

int CopyFiles(const char* srcfiles,const char* dstdir)
{
SHFILEOPSTRUCT sfop;
ZeroMemory(&sfop,sizeof(sfop));
sfop.wFunc = FO_COPY;
sfop.pFrom = srcfiles;
sfop.pTo = dstdir;
sfop.fFlags = FOF_NOCONFIRMMKDIR /*|FOF_SILENT*/ ;
return SHFileOperation(&sfop);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(0!=CopyFiles("c:\\temp\\*.*\0","c:\\temp2\0")){
   ShowMessage("Error!");
}
}


ymin 님이 쓰신 글 :
: 감사합니다. 간단한 예제를 좀 보여 줄수 있나요?
: 그리고 디렉토리 복사의 경우도 좀 가르쳐 주시겠습니까?
: 부탁합니다.
: .
:  님이 쓰신 글 :
: : ymin 님이 쓰신 글 :
: : : 프로그램 안에서 실행중에 파일과 디렉토리를 복사 혹은 이동하려면
: : : 어떤 명령어를 사용하면 되나요?
: :
: : BOOL CopyFile(
: :     LPCTSTR lpExistingFileName,    // pointer to name of an existing file
: :     LPCTSTR lpNewFileName,    // pointer to filename to copy to
: :     BOOL bFailIfExists     // flag for operation if file exists
: :    );   
: : http://msdn.microsoft.com/library/en-us/fileio/fs/copyfile.asp?frame=true
: :
: :  BOOL CopyFileEx(
: :     LPCWSTR lpExistingFileName,    // pointer to name of an existing file
: :     LPCWSTR lpNewFileName,    // pointer to filename to copy to
: :     LPPROGRESS_ROUTINE lpProgressRoutine,    // pointer to the callback function
: :     LPVOID lpData,    // to be passed to the callback function
: :     LPBOOL pbCancel,    // flag that can be used to cancel the operation
: :     DWORD dwCopyFlags    // flags that specify how the file is copied
: :    );
: : http://msdn.microsoft.com/library/en-us/fileio/fs/copyfileex.asp?frame=true
: :
: : int SHFileOperation(
: :   LPSHFILEOPSTRUCT lpFileOp
: : );
: : http://msdn.microsoft.com/library/en-us/wceshellui5/html/wce50lrfSHFileOperation.asp?frame=true

+ -

관련 글 리스트
43067 파일과 디렉토리 복사명령은? ymin 1028 2005/12/25
43068     Re:파일과 디렉토리 복사명령은? . 1551 2005/12/25
43070         Re:Re:파일과 디렉토리 복사명령은? ymin 1281 2005/12/26
43113             Re:Re:Re:파일과 디렉토리 복사명령은? . 1797 2005/12/29
43074             Re:Re:Re:VC++(Shell Programming)중 SHFileOperation 예제입니다.. 조성택 2019 2005/12/26
43126                 Re:Re:Re:Re:VC++(Shell Programming)중 SHFileOperation 예제입니다.. ymin 1506 2005/12/30
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.