#include <sys/types.h> #include <sys/stat.h> long dirExists( string dirName) { struct stat s; long argout = 0; if (!stat( dirName.c_str(), &s)) { if( s.st_mode & S_IFDIR) { argout = 1; } else { argout = 0; } } else { argout = 0; } return argout; }