コード例 #1
0
        internal static void FxDeleteFiles(string pPath)
        {
            DirectoryInfo ObjDirectory = new DirectoryInfo(pPath);

            if (Directory.Exists(pPath) == true)
            {
                foreach (FileInfo ObjFile in ObjDirectory.GetFiles())
                {
                    try
                    {
                        ObjFile.Delete();
                    }
                    catch
                    {
                        continue;
                    }
                }

                foreach (DirectoryInfo ObjSubDirectory in ObjDirectory.GetDirectories())
                {
                    FxDeleteFiles(ObjSubDirectory.FullName);

                    try
                    {
                        ObjSubDirectory.Delete();
                    }
                    catch
                    {
                        continue;
                    }
                }

                try
                {
                    ObjDirectory.Delete();
                }
                catch
                {
                    return;
                }
            }
        }