本文整理汇总了C++中CFileFind::IsDots方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileFind::IsDots方法的具体用法?C++ CFileFind::IsDots怎么用?C++ CFileFind::IsDots使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileFind
的用法示例。
在下文中一共展示了CFileFind::IsDots方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindExtensions
void InformApp::FindExtensions(void)
{
m_extensions.clear();
for (int i = 0; i < 2; i++)
{
CString path;
switch (i)
{
case 0:
path.Format("%s\\Internal\\Extensions\\*.*",(LPCSTR)GetAppDir());
break;
case 1:
path.Format("%s\\Inform\\Extensions\\*.*",(LPCSTR)GetHomeDir());
break;
default:
ASSERT(FALSE);
break;
}
CFileFind find;
BOOL finding = find.FindFile(path);
while (finding)
{
finding = find.FindNextFile();
if (!find.IsDots() && find.IsDirectory())
{
CString author = find.GetFileName();
if (author == "Reserved")
continue;
if ((author.GetLength() > 0) && (author.GetAt(0) == '.'))
continue;
path.Format("%s\\*.*",(LPCSTR)find.GetFilePath());
CFileFind find;
BOOL finding = find.FindFile(path);
while (finding)
{
finding = find.FindNextFile();
if (!find.IsDirectory())
{
CString ext = ::PathFindExtension(find.GetFilePath());
if (ext.CompareNoCase(".i7x") == 0)
m_extensions.push_back(ExtLocation(author,find.GetFileTitle(),(i == 0),find.GetFilePath()));
else if (ext.IsEmpty() && (i == 1))
{
// Rename an old-style extension (with no file extension) to end with ".i7x"
CString newPath = find.GetFilePath();
newPath.Append(".i7x");
if (::MoveFile(find.GetFilePath(),newPath))
m_extensions.push_back(ExtLocation(author,find.GetFileTitle(),(i == 0),newPath));
}
}
}
find.Close();
}
}
find.Close();
}
std::sort(m_extensions.begin(),m_extensions.end());
}
示例2: DeleteDir
BOOL CMyUtils::DeleteDir(LPCTSTR lpDirPath)
{
CFileFind finder;
BOOL bFind;
TCHAR strFindPath[MAX_PATH];
_stprintf(strFindPath, _T("%s\\*"), lpDirPath);
bFind = finder.FindFile(strFindPath);
while (bFind)
{
bFind = finder.FindNextFile();
if (!finder.IsDirectory())
{
if (!DeleteFile(finder.GetFilePath()))
{
finder.Close();
return FALSE;
}
}
else if (!finder.IsDots())
{
if (!DeleteDir(finder.GetFilePath()))
{
finder.Close();
return FALSE;
}
}
}
finder.Close();
return RemoveDirectory(lpDirPath);
}
示例3: rmDir
BOOL FileUtils::rmDir(string dirName)
{
char sTempFileFind[MAX_PATH] = "";
sprintf_s(sTempFileFind, "%s\\*.*", dirName.c_str());
CFileFind tempFind;
BOOL isFinded = tempFind.FindFile(sTempFileFind);
while (isFinded) {
isFinded = tempFind.FindNextFile();
/*
* 跳过 每个文件夹下面都有的两个特殊子文件夹:
* (1) . 表示本文件夹自己
* (2) .. 表示本文件夹的父文件夹
*/
if (!tempFind.IsDots()) {
char tempFileOrDir[MAX_PATH] = "";
sprintf_s(tempFileOrDir, "%s\\%s", dirName.c_str(), tempFind.GetFileName().GetBuffer(MAX_PATH));
if (tempFind.IsReadOnly()) ::SetFileAttributes(tempFileOrDir, FILE_ATTRIBUTE_NORMAL);
if (tempFind.IsDirectory()) rmDir(tempFileOrDir);
else ::DeleteFile(tempFileOrDir);
}
}
tempFind.Close();
return ::RemoveDirectory(dirName.c_str());
}
示例4: GetSkinList
void CSkinManager::GetSkinList(CStringArray &skins)
{
CFileFind finder;
CString dir = CMyUtility::GetCurDir();
CString strSkins;
strSkins.Format(_T("%s\\skins\\*.*"), dir);
BOOL bFind = finder.FindFile(strSkins);
if(!bFind)
return;
while(bFind)
{
bFind = finder.FindNextFile();
if(finder.IsDots())
continue;
if(finder.IsDirectory())
{
skins.Add(finder.GetFileName());
continue;
}
}
finder.Close();
}
示例5: AddFilesFromPath
bool CTestList::AddFilesFromPath( LPCTSTR pcszPath, HTREEITEM htreeParent )
{
CString strPath( pcszPath );
strPath += _T("\\*.*");
CFileFind finder;
BOOL bFound = finder.FindFile( strPath );
while( bFound )
{
bFound = finder.FindNextFile();
if( !finder.IsDots() )
{
CString strName( finder.GetFileName() );
if( strName.Find( _T(".html") ) != -1 || finder.IsDirectory() )
{
TVITEM tvi;
TVINSERTSTRUCT tvins;
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
UINT uItem = m_arrFile.GetSize();
const CString strFilePath( finder.GetFilePath() );
m_arrFile.Add( strFilePath );
// Set the text of the item.
tvi.pszText = (LPTSTR)(LPCTSTR)strName;
tvi.cchTextMax = strName.GetLength();
tvi.iImage = tvi.iSelectedImage = 0;
tvi.lParam = (LPARAM) uItem;
tvins.item = tvi;
tvins.hInsertAfter = TVI_LAST;
tvins.hParent = htreeParent;
//
// Add the item to the tree-view control.
HTREEITEM hTree = (HTREEITEM)m_treeList.SendMessage( TVM_INSERTITEM, 0, (LPARAM) (LPTVINSERTSTRUCT) &tvins);
if( strFilePath == m_strLastLoaded )
{
PostMessage( WM_MY_FIRST_SELECT, (WPARAM)hTree, 0 );
}
if( finder.IsDirectory() )
{
CString strPath( pcszPath );
strPath += _T("\\");
strPath += finder.GetFileName();
AddFilesFromPath( strPath, hTree );
}
}
}
}
return false;
}
示例6: freshSphLib
void CTestPage::freshSphLib()
{
DataBase db;
BOOL bTraining = FALSE;
db.ResetTable(_T("SpeechLib"),bTraining);
//CStringArray* idArray = db.GetAllUserInfo(_T("UserId"));
CString SpeechDir = _T("F:\\SpeechDirectory");
CString UserId,WavName,SphPath;
CFileFind finder;
UserId = _T("Test");
SphPath = SpeechDir + _T("\\") + UserId + _T("\\") + _T("*.wav");
BOOL res = finder.FindFile(SphPath);
while(res){
res = finder.FindNextFile();
if(finder.IsDots()||finder.IsDirectory())
continue;
WavName = finder.GetFileName();
db.InsertSpeechLib(UserId,WavName);
}
finder.Close();
}
示例7: RecursiveRemoveFolder
//////////////////////////////////////////////////////////////////////////
//递归删除文件夹
//////////////////////////////////////////////////////////////////////////
BOOL RecursiveRemoveFolder(CString strFolderPath,BOOL bRecursive)
{
CFileFind finder;
CString strPath;
BOOL bFound;
if (strFolderPath.ReverseFind('\\') != 0)
strFolderPath.Append(L"\\*.*");
bFound = finder.FindFile(strFolderPath);
while(bFound)
{
bFound = finder.FindNextFile();
strPath = finder.GetFilePath();
if (finder.IsDots())
continue;
else if (finder.IsDirectory() && bRecursive)
RecursiveRemoveFolder(strPath,bRecursive);
else
{
::SetFileAttributes(strPath,FILE_ATTRIBUTE_NORMAL);
::DeleteFile(strPath);
}
}
finder.Close();
return ::RemoveDirectory(strFolderPath);
}
示例8: RestoreFile
void CUpdateMgr::RestoreFile(wstring strRestorePath,wstring wsCurDirectory)
{
CFileFind fileFinder;
CString filePath ;//= strRestorePath.c_str() + _T("//*.*");
filePath.Format(_T("%s\\*.*"),strRestorePath.c_str());
BOOL bFinished = fileFinder.FindFile(filePath);
wstring wsDestfile;
wstring wsRestoreFile;
while(bFinished) //每次循环对应一个类别目录
{
bFinished = fileFinder.FindNextFile();
if(fileFinder.IsDirectory() && !fileFinder.IsDots()) //若是目录则递归调用此方法
{
// BayesCategoryTest(bt, fileFinder.GetFilePath());
}
else //再判断是否为txt文件
{
//获取文件类型
CString fileName = fileFinder.GetFileName();
if(fileName.Right(4).CompareNoCase(_T("_BAK")) == 0)
{
wsRestoreFile = strRestorePath + L"\\" + fileName.GetBuffer(0);
wsDestfile = wsCurDirectory + L"\\" + fileName.Left(fileName.GetLength()-4).GetBuffer(0);
BOOL bret = CsysFile::Copy(wsRestoreFile,wsDestfile);
if (FALSE == bret)
{
g_Logger.Error(__FILE__,__LINE__,"还原文件失败 restore %s to %s",ws2s(wsRestoreFile).c_str(),ws2s(wsDestfile).c_str());
}
}
}
}
}
示例9: directoryDelete
BOOL directoryDelete( LPCTSTR lpstrDir)
{
CFileFind cFinder;
CString csPath;
BOOL bWorking;
try
{
csPath.Format( _T( "%s\\*.*"), lpstrDir);
bWorking = cFinder.FindFile( csPath);
while (bWorking)
{
bWorking = cFinder.FindNextFile();
if (cFinder.IsDots())
continue;
if (cFinder.IsDirectory())
directoryDelete( cFinder.GetFilePath());
else
DeleteFile( cFinder.GetFilePath());
}
cFinder.Close();
return RemoveDirectory( lpstrDir);
}
catch (CException *pEx)
{
cFinder.Close();
pEx->Delete();
return FALSE;
}
}
示例10: DecryptDir
BOOL CEncryptFile::DecryptDir(CString strKey, CString strSrcDir, CString strDstDir, CProgressCtrl *pCtal)
{
//AfxMessageBox("创建文件夹"+target);
CFileFind finder;
CString stPath;
BOOL re = FALSE;
stPath.Format(_T("%s/*.*"), strSrcDir);
BOOL bWorking = finder.FindFile(stPath);
while (bWorking)
{
bWorking = finder.FindNextFile();
if (finder.IsDirectory() && !finder.IsDots())//是文件夹 而且 名称不含 . 或 ..
{
//递归解密+"/"+finder.GetFileName()
DecryptDir(strKey, finder.GetFilePath(), strDstDir + _T("\\") + finder.GetFileName(), pCtal);
}
else//是文件 则直接解密
{
CString stSrcFile = finder.GetFilePath();
BOOL result = (GetFileAttributes(stSrcFile) & FILE_ATTRIBUTE_DIRECTORY);
if (!result)
{
re = DecryptFile(strKey, finder.GetFilePath(), strDstDir + _T("\\") + finder.GetFileName());
pCtal->StepIt();
}
}
}
return TRUE;
}
示例11: SMT_GetAllFileName
/*=================================================================
* Function ID : SMT_GetAllFileName
* Input : void
* Output : void
* Author :
* Date : 2006 2
* Return : void
* Description : 得到所有文件名
* Notice :
*=================================================================*/
void CSmartCommunicationDlg::SMT_GetAllFileName(vector<CString>& VFileName)
{
CString szDir=m_DealPath;
CString strFile;
CFileFind ff;
if(szDir.Right(1)!= "\\")
{
szDir+="\\";
}
szDir+= "*.*";
BOOL res=ff.FindFile(szDir);
while(res)
{
res=ff.FindNextFile();
strFile=ff.GetFileName();
if(ff.IsDirectory() &&!ff.IsDots())
{
continue;
}
if( strFile=="." || strFile=="..")
{
continue;
}
VFileName.push_back(strFile);
}
ff.Close();
return ;
}
示例12: DeletePath
void Utils::DeletePath(CString sPath)
{
CFileFind tempFind;
bool IsFinded = tempFind.FindFile(sPath + "\\*.*");
while (IsFinded)
{
IsFinded = tempFind.FindNextFile();
//当这个目录中不含有.的时候,就是说这不是一个文件。
if (!tempFind.IsDots())
{
char sFoundFileName[200];
strcpy(sFoundFileName,tempFind.GetFileName().GetBuffer(200));
//如果是目录那么删除目录
if (tempFind.IsDirectory())
{
char sTempDir[200];
sprintf(sTempDir,"%s\\%s",sPath,sFoundFileName);
DeletePath(sTempDir); //其实真正删除文件的也就这两句,别的都是陪衬
}
//如果是文件那么删除文件
else
{
char sTempFileName[200];
sprintf(sTempFileName,"%s\\%s",sPath,sFoundFileName);
DeleteFile(sTempFileName);
}
}
}
tempFind.Close();
RemoveDirectory(sPath);
}
示例13: CheckCleanupFileLogFile
//日志文件清理
void CWriteLogThread::CheckCleanupFileLogFile()
{
if(m_nLogFileCleanupDate == 0)
{
return;
}
COleDateTime time1,time2;
COleDateTimeSpan time3;
time2 = COleDateTime::GetCurrentTime();
int nYear,nMonth,nDate;
sscanf(m_strLastCleanupLogFileDate, "%d:%d:%d",&nYear,&nMonth,&nDate);
time1.SetDate(nYear,nMonth,nDate);
time3 = time2 - time1;
int nRunData = time3.GetDays();
//程序连续运行m_nLogFileCleanupDate天进行一次日志文件清理,保存前一天的日志
//m_nLogFileCleanupDate可以调用SetLogFileCleanupDate()函数设置
if(nRunData >= m_nLogFileCleanupDate) //
{
m_strLastCleanupLogFileDate = CTime::GetCurrentTime().Format("%Y:%m:%d");
CFileFind tempFileFind;
CString szDir = m_strAppLogDir;
CString strTitle;
CFile file;
if(szDir.Right(1) != _T("\\"))
{
szDir += _T("\\");
}
szDir += _T("*.txt");
BOOL res = tempFileFind.FindFile(szDir);
CString strYesterdayLogName;
CTime time =CTime::GetCurrentTime() - CTimeSpan(1,0, 0,0);
strYesterdayLogName = time.Format("%Y%m%d"); //前一天的日期
CString strDeleteFilePath;
while( res )
{
res = tempFileFind.FindNextFile();
if(!tempFileFind.IsDirectory() && !tempFileFind.IsDots())
{
strTitle = tempFileFind.GetFileName();
if(strTitle.Find(strYesterdayLogName) == -1) //只保留前一天的日志文件
{
//删除txt文件
strDeleteFilePath.Format("%s\\%s",m_strAppLogDir,strTitle);
CFile::Remove(strDeleteFilePath);//删除文件
}
}
}
tempFileFind.Close();
}
}
示例14: BuildTree
BOOL CDirTreeCtrl::BuildTree(HTREEITEM hParent,LPCTSTR strPath)
{
CFileFind find;
HTREEITEM parent;
CString strTemp = strPath;
BOOL bFind;
if ( strTemp.Right(1) == _T('\\') ){
strTemp += _T("*.*");
}else{
strTemp += _T("\\*.*");
}
bFind = find.FindFile( strTemp );
while ( bFind ) {
bFind = find.FindNextFile();
if ( find.IsDirectory()){
if(!find.IsDots()){
parent = AddItem1(hParent, find.GetFilePath(), find.GetFileName());
BuildTree(parent, find.GetFilePath());
}
}else{
AddItem1(hParent, find.GetFilePath(), find.GetFileName());
}
}
return TRUE;
}
示例15: EmptyDir
void MusicUtils::EmptyDir(CString Dir)
{
CFileFind finder;
CFile cfile;
CString Add=L"\\*";
CString DirSpec=Dir+Add; //????????????
BOOL bWorking = finder.FindFile(DirSpec);
while (bWorking)
{
bWorking = finder.FindNextFile();
if(!finder.IsDots()) //????????
{
if(finder.IsDirectory()) //????????
{
CString strDirectory = finder.GetFilePath();
if(_rmdir((const char*)(LPSTR)(LPCTSTR)strDirectory)==-1)
{
EmptyDir(strDirectory);
}
bWorking = finder.FindFile(DirSpec);
}
else //???????
{
cfile.Remove(finder.GetFilePath());
}
}
}
finder.Close();
}