void CTestDlg::OnOK()
{
// TODO: Add extra validation here
DelEmptyFolder("C:\\Documents and Settings\\이윤기\\바탕 화면\\수동\\drmone.war");
CDialog::OnOK();
}
BOOL CTestDlg::DelEmptyFolder(CString strPath)
{
CFileFind finder;
int nValidCnt = 0;
BOOL bWorking = finder.FindFile(strPath + "\\*.*");
while (bWorking)
{
bWorking = finder.FindNextFile();
if(finder.IsDots()) continue;
else if(finder.IsDirectory())
{
if(DelEmptyFolder(finder.GetFilePath()) == TRUE)
nValidCnt++;
}
else
nValidCnt++;
}
if(nValidCnt == 0)
{
// 폴더 삭제 명령 작성할 위치
//cout << "Del: " << (LPCTSTR)strPath << endl;
TRACE("Del : %s\n",(LPCTSTR)strPath);
return FALSE;
}
return TRUE;
}
'개발 > Client Side' 카테고리의 다른 글
윈도우 프로그래밍 디버깅 방법 (0) | 2012.07.07 |
---|---|
[MFC] CFolderDialog 예제 (0) | 2010.11.19 |
[MFC] 디렉토리 recursive 탐색 소스 코드 (0) | 2010.11.19 |
VMWare에서 MacOS X 해상도 바꾸기 (0) | 2010.09.06 |
VC6 -> VS 2005 변환 후 wchar_t 문제 (0) | 2010.08.31 |