above code will search all files including sub directoriesCode:foreach (string filepath in System.IO.Directory.GetFiles(@"C:\Documents and Settings\user", "*.*", System.IO.SearchOption.AllDirectories)) { FileInfo fileSize = new FileInfo(filepath); if (fileSize.Length > 25000000) { File.SetAttributes(filepath, FileAttributes.Normal); listBox1.Items.Add(filepath.ToString() + "-" + fileSize.Length.ToString()); } label1.Text= listBox1.Items.Count.ToString(); }
but i want to EXCLUDE the file or folder below:
C:\Documents and Settings\user\Local Settings\Application Data\Microsoft\Outlook\*.*
how? tnx in advance...




Reply With Quote