Use function PathIsDirectoryEmpty. Some working facts about this API…
- Returns false if directory does not exist
- Returns true is directory is empty
- Return false if directory contains nested directories but no files
- Returns false if there are files in directory
- Returns false if given path points to a directory
- C: is considered a directory
- Does not auto expand environment variables in given path
- Ok with spaces in path
Usage…
[sourcecode language=”cpp”]CString Directory = _T( “C:\Nibu babu thomas” ); // This directory exists
const BOOL Empty = PathIsDirectoryEmpty( Directory ); // Call returns true
ASSERT( Empty );[/sourcecode]