+
+// Private function to check whether a file is a directory or not
+bool isDirectory(const char* filename) {
+ struct stat fileStat;
+ if (stat(filename, &fileStat) == -1) {
+ return false;
+ }
+ return(S_ISDIR(fileStat.st_mode));
+}
+
+
+// Private function to check whether a file is a regular file or not
+bool isFile(const char* filename) {
+ struct stat fileStat;
+ if (stat(filename, &fileStat) == -1) {
+ return false;
+ }
+ return(S_ISREG(fileStat.st_mode));
+}