foreach file in filelist ++seen{file} if seen{file} == 1 spaceneeded += file.size like that? In light that NFS may not report a useful block size, I think the rouding up to block size should be dropped altogether, also because filesystems may do different fancy stuff, including but not limited to, transparent compression.