Check directory or folder empty status

Use function PathIsDirectoryEmpty. Some working facts about this API…

  1. Returns false if directory does not exist
  2. Returns true is directory is empty
  3. Return false if directory contains nested directories but no files
  4. Returns false if there are files in directory
  5. Returns false if given path points to a directory
  6. C: is considered a directory
  7. Does not auto expand environment variables in given path
  8. 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]

Appreciate your comments...