bool File_Exists_And_Is_Regular_File(std::string path_to_file){
    if (File_Exists(path_to_file)){
        if (Is_Regular_File(path_to_file)){
            return true;
        }
    }
    return false;
}
Ejemplo n.º 2
0
int Get_Number_Of_Files_In_Directory(std::string path) {
	struct dirent* entry;
	DIR* dp;
	int count = 0;
	
	//add slash to the end if wer need it since we append the path onto the filename when storing
	if (path[path.size()-1] != '/'){path+="/";}
	
	//open folder
	dp = opendir(path.c_str());
	if (dp == NULL){ return 0;}
	
	//loop and store
	while ((entry = readdir(dp))){
		if (Is_Regular_File(path + entry->d_name)){
			++count;
		}
	}
	closedir(dp);
	return count;
 }