static int get_statfs(const char path, int64_t total, int64_t *available)
{
struct statfs disk;
if(!path || !total || !available)
return -1; *total = *available = 0; if(statfs(path, &disk) !=0) { printf(“statfs failed:%d\n”,errno); return -1; } *total = (int64_t)disk.f_blocks * disk.f_bsize; *available = (int64_t)disk.f_bavail * disk.f_bsize; return 0;}
免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:测算某个文件夹的容量 https://www.yhzz.com.cn/a/17515.html