Click here to Skip to main content
16,010,553 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralGetting HTML of a document loaded in CHTMLView Pin
Cabadam11-Jul-01 15:25
Cabadam11-Jul-01 15:25 
GeneralRe: Getting HTML of a document loaded in CHTMLView Pin
11-Jul-01 15:49
suss11-Jul-01 15:49 
GeneralRe: Getting HTML of a document loaded in CHTMLView Pin
Cabadam13-Jul-01 12:42
Cabadam13-Jul-01 12:42 
Generallist box item emphasis Pin
Wayne Janaway11-Jul-01 15:23
Wayne Janaway11-Jul-01 15:23 
GeneralRe: list box item emphasis Pin
Michael Dunn11-Jul-01 19:49
sitebuilderMichael Dunn11-Jul-01 19:49 
Generalcopy entire directory Pin
ThunderBird11-Jul-01 14:07
ThunderBird11-Jul-01 14:07 
GeneralRe: copy entire directory Pin
11-Jul-01 15:43
suss11-Jul-01 15:43 
GeneralRe: copy entire directory Pin
Tony Fontenot11-Jul-01 17:09
Tony Fontenot11-Jul-01 17:09 
I use this recursive funtion. basically is loops through the directory and copies files. if it finds a directory then it calls the function with that directory.

hope it helps.

OldFilesMask: the directory that contains the files. in the format of "C:\Directory\*".
NewFilesDirectory: the directory the files are being copied to. in the format of "E:\Directory"

void CCustomerDlg::CopyDiskFiles(CString OldFilesMask, CString NewFilesDirectory)
{
CString strOldSearchFile, strOldFile, strNewFile, strNewSearchFile;
CString strNewMask, strFileName, strMessage, strTemp;
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
int iSlash;

hFind = FindFirstFile(OldFilesMask, &FindFileData);
while (hFind != INVALID_HANDLE_VALUE)
{
strFileName.Format("%s", FindFileData.cFileName);
if (strFileName != "." && strFileName != "..")
{
strOldFile = OldFilesMask;
iSlash = strOldFile.ReverseFind('\\');
strOldFile.Delete(iSlash, strOldFile.GetLength() - iSlash);
strNewMask.Format("\\%s", strFileName);
strOldFile.Insert(iSlash, strNewMask);
strNewFile.Format("%s\\%s", NewFilesDirectory, strFileName);

if (FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
{
strOldFile = OldFilesMask;
CreateDirectory(strNewFile, NULL);
iSlash = strOldFile.ReverseFind('\\');
strOldFile.Delete(iSlash, strOldFile.GetLength() - iSlash);
strNewMask.Format("\\%s\\*", strFileName);
strOldFile.Insert(iSlash, strNewMask);
CopyDiskFiles(strOldFile, strNewFile, Product);
}
else
{
if (!CopyFile(strOldFile, strNewFile, FALSE))
{
strMessage.Format("Copy: '%s' to '%s' failed.", strOldFile, strNewFile);
AfxMessageBox(strMessage);
}
}
}
if (!FindNextFile(hFind, &FindFileData))
{
if (GetLastError () == ERROR_NO_MORE_FILES)
break;
}
}
FindClose(hFind);
}

Not much error checking but it fits my need. it may need some minor changes for your needs.

good luck Smile | :)

***********************
Tony Fontenot
Recreational Solutions
tony@recsolutions.com
***********************
GeneralRe: copy entire directory Pin
Kannan Kalyanaraman11-Jul-01 18:59
Kannan Kalyanaraman11-Jul-01 18:59 
Generalhelp: Creating toolbar at runtime Pin
SP11-Jul-01 13:21
SP11-Jul-01 13:21 
GeneralRe: help: Creating toolbar at runtime Pin
Tomasz Sowinski12-Jul-01 1:55
Tomasz Sowinski12-Jul-01 1:55 
GeneralRe: help: Creating toolbar at runtime Pin
SP17-Jul-01 11:48
SP17-Jul-01 11:48 
GeneralCOM Port question Pin
11-Jul-01 12:59
suss11-Jul-01 12:59 
GeneralRe: COM Port question Pin
John Uhlenbrock12-Jul-01 6:20
John Uhlenbrock12-Jul-01 6:20 
GeneralCOM Port question Pin
Richard Cheng11-Jul-01 12:59
Richard Cheng11-Jul-01 12:59 
GeneralList Box. Pin
John Uhlenbrock11-Jul-01 12:37
John Uhlenbrock11-Jul-01 12:37 
GeneralRe: List Box. Pin
Tomasz Sowinski12-Jul-01 1:37
Tomasz Sowinski12-Jul-01 1:37 
GeneralApplication Menu Iteration Pin
Paul de Bazin11-Jul-01 12:19
Paul de Bazin11-Jul-01 12:19 
GeneralRe: Application Menu Iteration Pin
Tomasz Sowinski12-Jul-01 1:51
Tomasz Sowinski12-Jul-01 1:51 
GeneralAdding CFileDialog as a Property Page Pin
Ganesh Agrawal11-Jul-01 12:07
Ganesh Agrawal11-Jul-01 12:07 
GeneralASCII to Float Conversion Pin
AaroC35711-Jul-01 10:21
AaroC35711-Jul-01 10:21 
GeneralRe: ASCII to Float Conversion Pin
Carlos Antollini11-Jul-01 10:59
Carlos Antollini11-Jul-01 10:59 
GeneralRe: ASCII to Float Conversion Pin
Michael Dunn11-Jul-01 19:53
sitebuilderMichael Dunn11-Jul-01 19:53 
GeneralC++ Certification question Pin
11-Jul-01 10:20
suss11-Jul-01 10:20 
GeneralRe: C++ Certification question Pin
Christian Graus11-Jul-01 13:07
protectorChristian Graus11-Jul-01 13:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.