Example #1
0
static file::size_type getDirSize(const file& d) {
	file::size_type res = 0;
	string path = d.path();
	vector<struct dirent> files = d.list_files((flags & F_ALL) != 0);
	for(auto it = files.begin(); it != files.end(); ++it) {
		file f(path,it->d_name);
		if(f.is_dir()) {
			string name = f.name();
			if(name != "." && name != "..")
				res += getDirSize(f);
		}
		else
			res += f.size();
	}
	return res;
}