Пример #1
0
        private void btn_DeleteAll_Click(object sender, EventArgs e)
        {
            if (!CheckFolderChoose())
            {
                MessageBox.Show("老哥,能先选择一下根文件夹么");
                return;
            }
            string        logFileName      = "DeleteNullFolder" + DateTime.Now.ToString("yyyyMMddhhmmss");
            int           totalDeleteCount = 0;
            List <string> pathList         = GetNullFolderPath();

            while (pathList.Count > 0)
            {
                Application.DoEvents();
                foreach (var item in pathList)
                {
                    Application.DoEvents();
                    if (Directory.Exists(item))
                    {
                        totalDeleteCount++;
                        Directory.Delete(item);
                        TxtHandle.OutTXTByString(item, logFileName);
                    }
                }
                pathList = GetNullFolderPath();
            }

            MessageBox.Show("老哥,搞完了,一共删了 " + totalDeleteCount + " 个空文件夹,清单:" + "D:\\ZhouJunLog\\" + logFileName + ".txt");
        }
Пример #2
0
        private void btn_Filter_Click(object sender, EventArgs e)
        {
            if (!CheckFolderChoose())
            {
                MessageBox.Show("老哥,能先选择一下根文件夹么");
                return;
            }

            string        logFileName = "GetNullFolder" + DateTime.Now.ToString("yyyyMMddhhmmss");
            List <string> pathList    = GetNullFolderPath();

            foreach (var item in pathList)
            {
                Application.DoEvents();
                TxtHandle.OutTXTByString(item, logFileName);
            }
            MessageBox.Show("老哥,搞完了,清单:" + "D:\\ZhouJunLog\\" + logFileName + ".txt");
        }