How to determine a folder is empty
-
Is there any single function to determine wether a folder is empty in VC++! Thanks in advance emmatty
emmatty wrote:
Is there any single function to determine wether a folder is empty in VC++!
AFAIK, there is no such function... I believe you have to make your own.. you can use
CFileFind
Class to achieve same..."Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV
-
Is there any single function to determine wether a folder is empty in VC++! Thanks in advance emmatty
There is not direct function in VC++(its not VB) but u can try finding the size of the folder but that u can find if its empty or not thank you :cool: Vikas Amin Embin Technology Bombay vikas.amin@embin.com
-
Is there any single function to determine wether a folder is empty in VC++! Thanks in advance emmatty
Something like:
bool IsFolderEmpty( LPCTSTR lpszFolder )
{
CFileFind fileFind;
CString strFolder(lpszFolder);
bool bFound,
bEmpty = true;bFound = fileFind.FindFile(strFolder + \_T("\*.\*")); while (bFound != FALSE) { bFound = fileFind.FindNextFile(); if (! fileFind.IsDots()) { bEmpty = false; break; } } return bEmpty;
}
"Take only what you need and leave the land as you found it." - Native American Proverb
-
Is there any single function to determine wether a folder is empty in VC++! Thanks in advance emmatty
::PathIsDirectoryEmpty()