Home > Windows API > Check directory or folder empty status

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…

CString Directory = _T( "C:\\Nibu babu thomas" ); // This directory exists
const BOOL Empty = PathIsDirectoryEmpty( Directory ); // Call returns true
ASSERT( Empty );
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: