Im trying to list in a listbox, the directory along with the directory size and wondered whether you could help, can only seem to get the size to list.
FolderBrowserDialog folderBrowerDialog = new FolderBrowserDialog();
folderBrowerDialog.ShowDialog();
string selectedPath = folderBrowerDialog.SelectedPath;
string[] selectedDirectories = Directory.GetDirectories(selectedPath);
long size = 0;
foreach (var dir in selectedDirectories)
{
string[] files = Directory.GetFiles(dir);
foreach (var file in files)
{
FileInfo fileInfo = new FileInfo(file);
size += fileInfo.Length;
}
}
listBox1.Items.Add(size);
Thanks in advance
Anthony

VulpesPosted Feb 21, 2012, 7:04 AM
Anthony ClarkePosted Feb 21, 2012, 7:09 AM