Folder Copy
-
Hi All How can i copy folder?I have a folde A whic have 9 file and 4 folder.And detination folder is B.I want to copy folder A in B.Plz help me
I haven't tried it myself, but I'm sure
SHFileOperation
will do this for you.«_Superman_»
-
I haven't tried it myself, but I'm sure
SHFileOperation
will do this for you.«_Superman_»
-
Hi All How can i copy folder?I have a folde A whic have 9 file and 4 folder.And detination folder is B.I want to copy folder A in B.Plz help me
Check this article CShellFileOp - Wrapper for SHFileOperation[^] by Michael Dunn[^]
«_Superman_»
-
Hi All How can i copy folder?I have a folde A whic have 9 file and 4 folder.And detination folder is B.I want to copy folder A in B.Plz help me
Try this code
bool CMainFrame::CopyFun(LPCTSTR lpctszSrc_i,LPCTSTR lpctszDetn_i)
{int nSrcLen = _tcslen(lpctszSrc_i);
int nDetnLen = _tcslen(lpctszDetn_i);TCHAR *pszFrom = new TCHAR[nSrcLen];
TCHAR *pszTo = new TCHAR[nDetnLen];_tcscpy(pszFrom, lpctszSrc_i);
_tcscpy(pszTo, lpctszDetn_i);pszFrom[nSrcLen] = 0;
pszFrom[nSrcLen+1] = 0;pszTo[nDetnLen] = 0;
pszTo[nDetnLen+1] = 0;SHFILEOPSTRUCT stFileop;
//stFileop.hwnd = NULL; // no status display
if("Copy" == m_csType )
{
stFileop.wFunc = FO_COPY; // copy operation
}
else
{
stFileop.wFunc = FO_MOVE; // cut operation
}stFileop.pFrom = pszFrom; // source file name as double null terminated string
stFileop.pTo = pszTo; //Destination//stFileop.fFlags = FOF_NOCONFIRMATION|FOF_SILENT; // do not prompt the user
stFileop.fAnyOperationsAborted = FALSE;
stFileop.lpszProgressTitle = NULL;
stFileop.hNameMappings = NULL;int ret = SHFileOperation(&stFileop);
//delete [] pszFrom;
//delete [] pszTo;return(ret == 0);
}
Here lpctszSrc_i & lpctszDetn_i are the src & detn full path.
-
Davitor wrote:
can you give example?
Since he's given you the name of the function to use, why not just search for an example? :rolleyes:
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch