Falcon
Yönetici
Kod:
string GetFileSize(string path)
{
long bytes = new FileInfo(path).Length;
string[] sizes = { "B", "KB", "MB", "GB", "TB" };
double len = bytes;
int order = 0;
while (len >= 1024 && order < sizes.Length - 1)
{
order++;
len /= 1024;
}
return $"{len:0.##} {sizes[order]}";
}
Kullanım : MessageBox.Show(GetFileSize(@"C:\test\dosya.zip"));