Exemple #1
0
        private void DoWork(string selectedPath)
        {
            FolderData fd = new FolderData(selectedPath);

            listBox.Items.Add(fd);

            DirectoryInfo di = new DirectoryInfo(selectedPath);

            CollectDirs(di, fd);
        }
Exemple #2
0
        private void CollectDirs(DirectoryInfo di, FolderData fd)
        {
            try
            {
                foreach (var file in di.GetFiles())
                {
                    try
                    {
                        fd.Bytes += file.Length;
                    }
                    catch { }
                }
            }
            catch { }

            try
            {
                foreach (var d in di.GetDirectories())
                {
                    CollectDirs(d, fd);
                }
            }
            catch { }
        }