보리 님이 쓰신 글 :
: 폴더는 RmDir 또는 RemoveDir 로 지우시면 됩니다.
:
: 헬프에서 "File management routines"을 검색 해서 찾아 보시면 도움이 될겁니다.
:
: 공부중 님이 쓰신 글 :
: : 폴더 안에 파일들은 DeleteFile("삭제할 파일 이름") 을 이용 하여 삭제 하였습니다.
: : 폴더 를 지우는 방법 도 동일 하게DeleteFile("삭제할 폴더 명") 이렇해 하는건가요?
리컬시브로 하위 파일 및 디렉터리 삭제 루틴입니다.
도움이 되시길..
AnsiString strFileFound ;
strFileFound = strFilePath ;
strFileFound += "\\*.*" ;
HANDLE hp ;
WIN32_FIND_DATA info ;
AnsiString strCopyPath = strFileFound ;
char chFilePath[1024] = {0,} ;
strcpy(chFilePath, strCopyPath.c_str());
hp = FindFirstFile(chFilePath, &info);
if (hp == INVALID_HANDLE_VALUE) { // Nofile
RemoveDirectory(chFilePath);
return ;
}
do {
if (!((strcmp(info.cFileName, ".")==0) ||(strcmp(info.cFileName, "..")==0)) ) {
if ( (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) {
AnsiString strSubDirectory = strFilePath ;
strSubDirectory += "\\"; strSubDirectory += info.cFileName;
DeleteDirectorySet(strSubDirectory);
char chDirPath[1024] = {0,} ;
strcpy(chDirPath , strSubDirectory.c_str());
RemoveDirectory(chDirPath);
}
else {
strFileFound = strFilePath ; strFileFound += "\\" ; strFileFound += info.cFileName ;
bool retVal = DeleteFile(strFileFound); // Shift Del
}
}
} while (FindNextFile(hp,&info)) ;
FindClose(hp);
RemoveDirectory(strFilePath.c_str()); |