정리

SHFileOperation API (RemoveDirectory API 대체 사용)

저장소/VC++

RemoveDirectory API의 경우 폴더에 하위 구성이 존재할 경우 실패 발생.

SHFileOperation API 사용으로 이를 해결 가능.



SHFileOperation

http://msdn.microsoft.com/en-us/library/windows/desktop/bb762164(v=vs.85).aspx

int SHFileOperation(
  _Inout_  LPSHFILEOPSTRUCT lpFileOp 

);


SHFILEOPSTRUCT structure

http://msdn.microsoft.com/en-us/library/windows/desktop/bb759795(v=vs.85).aspx

typedef struct _SHFILEOPSTRUCT { HWND         hwnd; UINT         wFunc; PCZZTSTR     pFrom;    // This string must be double-null terminated.

PCZZTSTR     pTo;      // This string must be double-null terminated.

FILEOP_FLAGS fFlags; BOOL         fAnyOperationsAborted; LPVOID       hNameMappings; PCTSTR       lpszProgressTitle; 

} SHFILEOPSTRUCT, *LPSHFILEOPSTRUCT;


※ 주의

pFrom, pTo 문자열은 반드시 double-null terminated 이어야 한다. 

Although this member is declared as a single null-terminated string, it is actually a buffer that can hold multiple null-delimited file names. Each file name is terminated by a single NULL character. The last file name is terminated with a double NULL character ("\0\0") to indicate the end of the buffer.