.NET 3.x Access to the path 'C:\System Volume Information' is denied при поиске - C#
Формулировка задачи:
Уже замотался с этим. Вот код:
Сейчас тот самый результат как и с Подскажите как обойти эту директорию, мне ее не нужно.
static List<string> LookIn(string path)
{
List<string> files = new List<string>();
List<string> dirs = new List<string>();
try
{
files.AddRange(Directory.GetFiles(path));
dirs.AddRange(Directory.GetDirectories(path));
}
catch (UnauthorizedAccessException e)
{
Console.WriteLine(e.Message);
}
if (files != null)
{
for (int i = 0; i <= files.Count - 1; i++)
{
if (CheckFileLessThan2Gb(files[i])) { }
else files.RemoveAt(i);
}
if (dirs != null)
{
foreach (string dir in dirs)
{
LookIn(dir);
}
}
return files;
}
else return null;
}files.AddRange(Directory.GetFiles(path,"*.*",SearchOption.AllDirectories));
Решение задачи: «.NET 3.x Access to the path 'C:\System Volume Information' is denied при поиске»
textual
Листинг программы
static void Main(string[] args)
{
if (args.Length != 0)
{
if (args.Length == 1)
{
List<string> ListOfFiles = new List<string>();
ListOfFiles.AddRange(LookIn(args[0]));
}
else Console.WriteLine("So many arguments... o_O");
}
else Console.WriteLine("Write some stuff here!");
}