One-by-one file deletion for a derived list of files I have the following C# code for deleting files from a folder (and from its sub folders) excluding a list of files specified in an Excel file. The code works fine. 

The deletion is happening one-by-one in a for loop. Is there a way to improve its performance by reducing the time taken for deletion?

class Program
{
    public static List&lt;string&gt; AllFilesStaticList = new List&lt;string&gt;();

    static void Main(string[] args)
    {

        string locationOfExcelList = @"G:\Test1\ExclusionList.xls";
        string sheetName = "List$";
        string sourceDirectory = @"G:\TFS2\";

        List&lt;string&gt; excludeList = Import_To_DataTable_FromExcel(locationOfExcelList, sheetName);
        ProcessAllDirectoryToGetFileList(sourceDirectory);

        //Get files to be deleted (Items that are not present in excludeList)
        List&lt;string&gt; eligibleListToProcess = AllFilesStaticList.Where(x =&gt; !excludeList.Any(y =&gt; x.Contains(y))).ToList();


        //Iterating two lists - need to be improved
        foreach (string fileEntry in eligibleListToProcess)
        {
            try
            {
                if (File.Exists(fileEntry))
                {
                    //foreach delete need to be made more efficient
                    File.Delete(fileEntry);
                    Console.WriteLine(fileEntry);
                }
            }
            catch
            {
                //Hide the exception for now
            }
        }
        Console.ReadLine();
    }

    // Process all files in the directory passed in, recurse on any directories 
    // that are found, and process the files they contain.
    public static  void ProcessAllDirectoryToGetFileList(string targetDirectory)
    {
        // Process the list of files found in the directory.
        //Get files with their path
        string[] fileEntries = Directory.GetFiles(targetDirectory);
        foreach (string fileName in fileEntries)
        {
            AddFile(fileName);
        }

        // Recurse into subdirectories of this directory.
        string[] subdirectoryEntries = Directory.GetDirectories(targetDirectory);
        foreach (string subdirectory in subdirectoryEntries)
        {
            ProcessAllDirectoryToGetFileList(subdirectory);
        }
    }

    public static void AddFile(string fileName)
    {
        //Console.WriteLine();
        AllFilesStaticList.Add(fileName);
    }



    private static List&lt;string&gt; Import_To_DataTable_FromExcel(string FilePath,string sheetName)
    {
        List&lt;string&gt; deploymentFiles = new List&lt;string&gt;();

        string conStr = null;
        conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 8.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text'";

        conStr = string.Format(conStr, FilePath);
        OleDbConnection connExcel = new OleDbConnection(conStr);
        OleDbCommand cmdExcel = new OleDbCommand();
        OleDbDataAdapter oda = new OleDbDataAdapter();

        cmdExcel.Connection = connExcel;


        connExcel.Open();
        DataTable dtExcelSchema = default(DataTable);
        dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);


        connExcel.Close();

        //Read Data from First Sheet 
        connExcel.Open();
        cmdExcel.CommandText = "SELECT * From [" + sheetName + "]";
        oda.SelectCommand = cmdExcel;

        DataTable deploymentListTable = new DataTable("deploymentListTable");
        oda.Fill(deploymentListTable);
        connExcel.Close();


        foreach (DataRow row in deploymentListTable.Rows )
        {
            //Read third column from the excel sheet
            string cellFileName = row[2].ToString();
            if (!String.IsNullOrEmpty(cellFileName))
            {
                deploymentFiles.Add(cellFileName);
            }
        }

        return deploymentFiles;


    }



}
I may suggest the following : why checking for file deletion ?

if (File.Exists(fileEntry))


After all, in file.delete documentation we have :


  If the file to be deleted does not exist, no exception is thrown.