void GetFolderInfo(LPCTSTR lpszPath);
bool MoveFolder(LPCTSTR lpszFromPath, LPCTSTR lpszToPath);
bool ReNameFolder(LPCTSTR lpszFromPath, LPCTSTR lpszToPath);
bool DeleteFolder(LPCTSTR lpszPath);
bool CopyFolder(LPCTSTR lpszFromPath, LPCTSTR lpszToPath);
bool MoveFolder(LPCTSTR lpszFromPath, LPCTSTR lpszToPath)
{
int nLengthFrm = strlen(lpszFromPath);
char* NewPathFrm = new char[nLengthFrm + 2];
strcpy(NewPathFrm, lpszFromPath);
NewPathFrm[nLengthFrm] = ' ';
NewPathFrm[nLengthFrm + 1] = ' ';
SHFILEOPSTRUCT FileOp;
ZeroMemory((void*)&FileOp, sizeof(SHFILEOPSTRUCT));
FileOp.fFlags = FOF_NOCONFIRMATION;
FileOp.hNameMappings = NULL;
FileOp.hwnd = NULL;
FileOp.lpszProgressTitle = NULL;
FileOp.pFrom = NewPathFrm;
FileOp.pTo = lpszToPath;
FileOp.wFunc = FO_MOVE;
return SHFileOperation(&FileOp) == 0;
}
bool ReNameFolder(LPCTSTR lpszFromPath, LPCTSTR lpszToPath)
{
int nLengthFrm = strlen(lpszFromPath);
char* NewPathFrm = new char[nLengthFrm + 2]();
strcpy(NewPathFrm, lpszFromPath);
SHFILEOPSTRUCT FileOp;
ZeroMemory((void*)&FileOp, sizeof(SHFILEOPSTRUCT));
FileOp.fFlags = FOF_NOCONFIRMATION;
FileOp.hNameMappings = NULL;
FileOp.hwnd = NULL;
FileOp.lpszProgressTitle = NULL;
FileOp.pFrom = NewPathFrm;
FileOp.pTo = lpszToPath;
FileOp.wFunc = FO_RENAME;
return SHFileOperation(&FileOp) == 0;
}
bool DeleteFolder(LPCTSTR lpszPath)
{
int nLength = strlen(lpszPath);
char* NewPath = new char[nLength + 2]();
strcpy(NewPath, lpszPath);
SHFILEOPSTRUCT FileOp;
ZeroMemory((void*)&FileOp, sizeof(SHFILEOPSTRUCT));
FileOp.fFlags = FOF_NOCONFIRMATION|FOF_SILENT;
FileOp.hNameMappings = NULL;
FileOp.hwnd = NULL;
FileOp.lpszProgressTitle = NULL;
FileOp.pFrom = NewPath;
FileOp.pTo = NULL;
FileOp.wFunc = FO_DELETE;
return SHFileOperation(&FileOp) == 0;
}
bool CopyFolder(LPCTSTR lpszFromPath, LPCTSTR lpszToPath)
{
int nLengthFrm = strlen(lpszFromPath);
char* NewPathFrm = new char[nLengthFrm + 2]();
strcpy(NewPathFrm, lpszFromPath);
SHFILEOPSTRUCT FileOp;
ZeroMemory((void*)&FileOp, sizeof(SHFILEOPSTRUCT));
FileOp.fFlags = FOF_NOCONFIRMATION;
FileOp.hNameMappings = NULL;
FileOp.hwnd = NULL;
FileOp.lpszProgressTitle = NULL;
FileOp.pFrom = NewPathFrm;
FileOp.pTo = lpszToPath;
FileOp.wFunc = FO_COPY;
return SHFileOperation(&FileOp) == 0;
}