예제 #1
0
        public static void RemoveDeletedItems(string strDirectoryPath, SearchOption enuDeleteScope)
        {
            bool blnDirectoryExists = DirectoryManager.Exists(strDirectoryPath);

            if (blnDirectoryExists == true)
            {
                string strSearchPattern = "*" + FileManager.DeleteExtension;

                try
                {
                    string[] strDeletedDirectories = Directory.GetDirectories(strDirectoryPath, strSearchPattern, enuDeleteScope);
                    foreach (string strDeletedDirectory in strDeletedDirectories)
                    {
                        try
                        {
                            DirectoryManager.Delete(strDeletedDirectory, false);
                        }
                        catch
                        {
                            /// Ignore any errors since we are trying to remove files that
                            /// are marked for deletion.
                            ///
                        }
                    }
                }
                catch
                {
                    /// Ignore any errors since we are trying to remove files that
                    /// are marked for deletion.
                    ///
                }

                try
                {
                    string[] strDeletedFiles = Directory.GetFiles(strDirectoryPath, strSearchPattern, SearchOption.TopDirectoryOnly);
                    foreach (string strDeletedFile in strDeletedFiles)
                    {
                        try
                        {
                            FileManager.Delete(strDeletedFile, false);
                        }
                        catch
                        {
                            /// Ignore any errors since we are trying to remove files that
                            /// are marked for deletion.
                            ///
                        }
                    }
                }
                catch
                {
                    /// Ignore any errors since we are trying to remove files that
                    /// are marked for deletion.
                    ///
                }
            }
        }
예제 #2
0
 public static void Delete(string strDirectoryPath)
 {
     DirectoryManager.Delete(strDirectoryPath, true);
 }